我有一个函数photos-with-keyword-starting
使用 monger 从 MongoDB 实例获取给定关键字的照片列表,另一个使用set/intersection
.
(defn photos-with-keywords-starting [stems]
(apply set/intersection
(map set
(map photos-with-keyword-starting stems))))
以前我认为这很好用,但是由于添加了更多记录,所以交集不能按预期工作——它错过了很多同时包含两个关键字的记录。
我注意到对该函数的调用photos-with-keyword-starting
总是最多返回 256 个结果:
=> (count (photos-with-keyword-starting "lisa"))
256
这是该函数的代码:
(defn photos-with-keyword-starting [stem]
(with-db (q/find {:keywords {$regex (str "^" stem)}})
(q/sort {:datetime 1})))
因此,如果在 MongoDB 中查找记录的调用不会返回超过 256 条记录的所有记录,因此在指定多个关键字时我没有得到正确的子集。
如何提高此限制?