How to implement OR in mongodb $text full-text search?
迷茫
迷茫 2017-05-02 09:26:13
0
1
624

""ssl certificate" authority key"

The $text operator searches for the phrase "ssl certificate" and ("authority" or "key" or "ssl" or "certificate" ).

This is an example in the document. The words enclosed in " are called Phrases. MongoDB performs the AND operation for them. Other words are separated by spaces and perform the OR operation.

{"$text": {"$search": ""ssl certificate" authority key"}}'s search results will definitely contain "ssl certificate".
Is there a way to implement full-text search for 'ssl certificate', 'authority', 'key'?

迷茫
迷茫

业精于勤,荒于嬉;行成于思,毁于随。

reply all(1)
習慣沉默

In your request, the current approach is: divide the query into 2 statements,

1. Query phrase: ""ssl certificate""

2. Query a single word: "authority key"

Then combine the results of the two statements into one place in the program.

For reference.

Love MongoDB! Have Fun!


MongoDB Chinese Community Shenzhen User Conference

This Saturday, let’s make an appointment

Please enter for details

Please participate in the Shenzhen User Conference and ask more questions to the big players in Shenzhen

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template