Text Search - matching multiple values

37 views
Skip to first unread message

Felipe Albrecht

unread,
May 14, 2014, 8:21:07 AM5/14/14
to mongod...@googlegroups.com
Hello,


" MongoDB performs a logical OR search of the terms unless specified as a phrase."

So, how can I do a text search where all the words should appear but they not compose a phase?

From instance: "word cup brazil"  is translated to "word" OR "cup" OR "brazil". How I do "word" AND "cup" AND "brazil" ?

Thank you,
Felipe Albrecht

Jason Rassi

unread,
May 14, 2014, 11:58:33 AM5/14/14
to mongod...@googlegroups.com
Please file a feature request for this at <https://jira.mongodb.org/browse/SERVER>.

As a workaround, use {$text: {$search: "\"word\" \"cup\" \"brazil\""}}.  This will still examine all documents in the union of the three index scans instead of the intersection, however (and you won't be able to take advantage of the stemming functionality to see results that contain similar terms).

Felipe Albrecht

unread,
May 14, 2014, 12:12:00 PM5/14/14
to mongod...@googlegroups.com
Thank for the solution, it worked perfectly.

I also filed a feature request: https://jira.mongodb.org/browse/SERVER-13947


--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.
 
For other MongoDB technical support options, see: http://www.mongodb.org/about/support/.
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user...@googlegroups.com.
To post to this group, send email to mongod...@googlegroups.com.
Visit this group at http://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/e78c9042-2659-4e6c-8315-d4add170f378%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages