Skip to content

Instantly share code, notes, and snippets.

@mchernyavskaya
Last active October 3, 2022 13:47
Show Gist options
  • Save mchernyavskaya/d44b64020f0a201e3aad19776fd96a03 to your computer and use it in GitHub Desktop.
Save mchernyavskaya/d44b64020f0a201e3aad19776fd96a03 to your computer and use it in GitHub Desktop.
Features MongoDb Text Search Lucene
Term search Yes Yes
Phrase search Yes (put the phrase in double quotes (backslashed): “\”native accused\””) Yes
OR search Yes (Just type the two terms in a query: “native accused”) Yes (there’s an “OR” or just the space between the terms)
AND search Yes (if you quote each of the terms as in phrase search that will work like an “AND” query) Yes (there’s an “AND” operator or a + operator which means that the word is required)
NOT search Yes (add a “-” in front of the negated word) Yes (there’s a “NOT” operator and a “-” which works the same way)
Grouping No The terms can be grouped by parentheses like:(one two) AND three which means either “one” or “two” should be in the text and “three” is required
Wildcard searches No (not in the text index. There’s a regex search though which can be used for the purpose) Yes (“*” and “?” are applied)
Fuzzy searches No Yes (tilde notation is used. “roam”~ means “find me all the items containing a word similar to roam”)
Proximity searches No (similar functionality can be reached with regex but it would be complicated) Yes (“one two”~10 means “find me words ‘one’ and ‘two’ within 10 words of each other”)
Boosting a term No Yes (“one^2 two” means that “one” is more important than “two”)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment