I want to search documents by the text, and I may search with one or more words. For example, I may search by “coffee”, or I may search by “coffee tea”. In my database some documents contains “coffee” only, some documents contains “tea” only, and there are some documents contains both “coffee” and “tea”. I want to make sure for the documents have both “coffee” and “tea”, the text score is higher than the documents have “coffee” only or have “tea” only. I read the guideline at https://docs.mongodb.com/manual/reference/operator/query/text/#search-for-a-phrase, but here I don’t want to search the “coffee tea” as a whole phrase (in my document the coffee and tea may not connected in sequence, i.e. it may be “coffee and tea”). How can I implement this scenario by the text search statement?
Thanks a lot for the help,