3 ms·
In my particular case, I noticed continual slow down every 1000 or so documents I kept creating when using mongoid_search. I was only doing a simple search, ind
by ryanfitz 16y ago
In my particular case, I noticed continual slow down every 1000 or so documents I kept creating when using mongoid_search. I was only doing a simple search, indexing on just a title field in my documents.
- mathias_10gen 16y agoBased on my quick reading* of the mongoid_search code it looks like it is using a regex query against the keywords array which requires a full scan over the index. In fact the way it is being done is probably far less efficient than just doing a normal regex table scan without the keyword array. If you were to modify the search method to do a normal string query (maybe using $in for OR and $all for AND) you should get much better performance. *Ruby isn't my native language so I may be missing something.
- dblock 16y agoYes. But don't confuse with mongoid_fulltext. It doesn't do any regexes, it uses map/reduce where each n-gram is indexed separately.