I am doing a multiple search with Pymongo, I would like to use various keywords to search them but it does not work.
My query here:
(this will show all of the "ABC" and "JKL" results, but I only want to search the results containing both "ABC" and "JKL".
# multiple search (one ADD one , show all one, and two keyword results)
searchQuery = {
'$text': {
'$search': "ABC JKL",
}}
I also tried this but it said "too many text expressions"
searchQuery = {
"$and":[
{'$text': {'$search': 'ABC'}},
{'$text': {'$search': 'JKL'}},
]}
Solved and find the answer here:
MongoDB Text Search AND multiple search words