小编Jor*_*rdi的帖子

在聚合框架中使用文本搜索时的 MongoDB 索引优化

我们正在 MongoDB 上构建一个简化版本的搜索引擎。

样本数据集

{ "_id" : 1, "dept" : "tech", "updDate":  ISODate("2014-08-27T09:45:35Z"), "description" : "lime green computer" }
{ "_id" : 2, "dept" : "tech", "updDate":  ISODate("2014-07-27T09:45:35Z"), "description" : "wireless red mouse" }
{ "_id" : 3, "dept" : "kitchen", "updDate":  ISODate("2014-04-27T09:45:35Z"), "description" : "green placemat" }
{ "_id" : 4, "dept" : "kitchen", "updDate":  ISODate("2014-05-27T09:45:35Z"), "description" : "red peeler" }
{ "_id" : 5, "dept" : "food", "updDate":  ISODate("2014-04-27T09:45:35Z"), "description" : "green apple" }
{ "_id" : 6, …
Run Code Online (Sandbox Code Playgroud)

text-search mongodb aggregation-framework mongodb-indexes

5
推荐指数
0
解决办法
768
查看次数