You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
result = client["sample_mflix"]["movies"].aggregate([
81
81
{
82
-
"$search": {
83
-
"index": "pymongoindex",
84
-
"phrase": {
85
-
"path": "title",
86
-
"query": "new york"
87
-
}
88
-
}
82
+
"$search": {
83
+
"index": "pymongoindex",
84
+
"compound": {
85
+
"mustNot": [
86
+
{
87
+
"text": {
88
+
"query": [
89
+
"Comedy"
90
+
],
91
+
"path": "genres"
92
+
}
93
+
}
94
+
],
95
+
"must": [
96
+
{
97
+
"text": {
98
+
"query": [
99
+
"new york"
100
+
],
101
+
"path": "title"
102
+
}
103
+
}
104
+
],
105
+
}
106
+
}
89
107
},
90
108
{ "$limit": 10 },
91
109
{
92
110
"$project": {
93
111
"_id": 0,
94
112
"title": 1,
95
113
"score": { "$meta": "searchScore" }
96
-
}
97
-
}
98
-
])
114
+
}
115
+
}
116
+
])
99
117
100
118
for i in result:
101
119
print(i)
@@ -104,21 +122,27 @@ The query also includes the following stages:
104
122
:language: none
105
123
:visible: false
106
124
107
-
{title: 'New York, New York', score: 6.786321640014648 }
108
-
{title: 'New York', score: 6.258549213409424 }
109
-
{title: 'New York Stories', score: 5.3813982009887695 }
110
-
{title: 'New York Minute', score: 5.3813982009887695 }
111
-
{title: 'Synecdoche, New York', score: 5.3813982009887695 }
112
-
{title: 'New York Doll', score: 5.3813982009887695 }
113
-
{title: 'Little New York', score: 5.3813982009887695 }
114
-
{title: 'Escape from New York', score: 4.719893455505371 }
115
-
{title: 'Naked in New York', score: 4.719893455505371 }
116
-
{title: 'Autumn in New York', score: 4.719893455505371 }
125
+
{'title': 'New York, New York', 'score': 6.786379814147949}
126
+
{'title': 'New York', 'score': 6.258603096008301}
127
+
{'title': 'New York Doll', 'score': 5.381444931030273}
128
+
{'title': 'Escape from New York', 'score': 4.719935417175293}
129
+
{'title': 'Autumn in New York', 'score': 4.719935417175293}
130
+
{'title': 'Sleepless in New York', 'score': 4.719935417175293}
131
+
{'title': 'Gangs of New York', 'score': 4.719935417175293}
132
+
{'title': 'Sherlock Holmes in New York', 'score': 4.203253746032715}
133
+
{'title': 'New York: A Documentary Film', 'score': 4.203253746032715}
134
+
{'title': 'An Englishman in New York', 'score': 4.203253746032715}
117
135
118
136
Additional Information
119
137
----------------------
120
138
121
-
To learn more about the available Atlas Search operators, see the :atlas:`Operators and Collectors </atlas-search/operators-and-collectors>` guide in the MongoDB Atlas documentation.
122
-
139
+
To learn more about the available Atlas Search operators, see the :atlas:`Operators and
140
+
Collectors </atlas-search/operators-and-collectors>` guide in the MongoDB Atlas
141
+
documentation.
142
+
ß
123
143
For more information about Atlas Search, and to view more query examples, see the
0 commit comments