Skip to content

Commit 6c116b3

Browse files
committed
Update docs.
1 parent 87c2ecd commit 6c116b3

File tree

2 files changed

+55
-28
lines changed

2 files changed

+55
-28
lines changed

docs/source/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ Models
4040
- :doc:`ref/models/querysets`
4141
- :doc:`ref/models/models`
4242
- :doc:`ref/models/indexes`
43+
- :doc:`ref/models/search`
4344
- :doc:`ref/database`
4445
- :doc:`ref/contrib/gis`
4546

docs/source/ref/models/search.rst

Lines changed: 54 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ The ``path`` argument can be either the name of a field (as a string), or a
5252

5353
The ``value`` argument must be a string or a :class:`~django.db.models.Value`.
5454

55-
An optional ``score`` :class:`SearchScoreOption` argument to tune the
55+
The optional ``score`` :class:`SearchScoreOption` argument to tune the
5656
relevance score.
5757

5858
``SearchAutocomplete``
@@ -92,7 +92,9 @@ Optional arguments:
9292
``SearchExists``
9393
----------------
9494

95-
Atlas Search expression that matches documents where a field exists.
95+
.. class:: SearchExists(path, *, score=None)
96+
97+
Matches documents where a field exists.
9698

9799
This expression uses the :doc:`exists operator <atlas:atlas-search/exists>`
98100
to check whether the specified path is present in the document. It's useful
@@ -110,14 +112,15 @@ for filtering documents that include (or exclude) optional fields.
110112
The ``path`` argument specifies the document path to check and can be provided
111113
as a string or a :class:`~django.db.models.F`.
112114

113-
An optional :class:`SearchScoreOption` ``score`` argument can be used to
115+
The optional :class:`SearchScoreOption` ``score`` argument can be used to
114116
modify the relevance score of the result.
115117

116118
``SearchIn``
117119
------------
118120

119-
Atlas Search expression that matches documents where a field's value is in a
120-
given list.
121+
.. class:: SearchIn(path, value, *, score=None)
122+
123+
Matches documents where a field's value is in a given list.
121124

122125
This expression uses the :doc:`in operator <atlas:atlas-search/in>` to match
123126
documents whose field contains a value from the provided array.
@@ -135,13 +138,15 @@ The ``path`` argument can be the name of a field (as a string) or a
135138
:class:`~django.db.models.F`. The ``value`` must be a list
136139
of values or a :class:`~django.db.models.Value`.
137140

138-
An optional ``score`` :class:`SearchScoreOption` argument to tune the
141+
The optional ``score`` :class:`SearchScoreOption` argument to tune the
139142
relevance score.
140143

141144
``SearchPhrase``
142145
----------------
143146

144-
Atlas Search expression that matches a phrase in the specified field.
147+
.. class:: SearchPhrase(path, query, *, slop=None, synonyms=None, score=None)
148+
149+
Matches a phrase in the specified field.
145150

146151
This expression uses the :doc:`phrase operator <atlas:atlas-search/phrase>` to
147152
find exact or near-exact sequences of terms. It supports optional slop
@@ -171,7 +176,9 @@ Optional arguments:
171176
``SearchQueryString``
172177
---------------------
173178

174-
Atlas Search expression that matches using a Lucene-style query string.
179+
.. class:: SearchQueryString(path, query, *, score=None)
180+
181+
Matches using a Lucene-style query string.
175182

176183
This expression uses the
177184
:doc:`queryString operator <atlas:atlas-search/queryString>` to parse and
@@ -193,14 +200,15 @@ The ``path`` argument can be a string or a
193200
:class:`~django.db.models.F` representing the field to query.
194201
The ``query`` argument is a Lucene-style query string.
195202

196-
An optional ``score`` :class:`SearchScoreOption` argument to tune the
203+
The optional ``score`` :class:`SearchScoreOption` argument to tune the
197204
relevance score.
198205

199206
``SearchRange``
200207
---------------
201208

202-
Atlas Search expression that filters documents within a specified range of
203-
values.
209+
.. class:: SearchRange(path, *, lt=None, lte=None, gt=None, gte=None, score=None)
210+
211+
Filters documents within a specified range of values.
204212

205213
This expression uses the :doc:`range operator <atlas:atlas-search/range>` to
206214
match numeric, date, or other comparable fields based on upper and/or lower
@@ -229,7 +237,9 @@ Optional arguments:
229237
``SearchRegex``
230238
---------------
231239

232-
Atlas Search expression that matches string fields using a regular expression.
240+
.. class:: SearchRegex(path, query, *, allow_analyzed_field=None, score=None)
241+
242+
Matches string fields using a regular expression.
233243

234244
This expression uses the :doc:`regex operator <atlas:atlas-search/regex>` to
235245
apply a regular expression pattern to the contents of a specified field.
@@ -256,8 +266,10 @@ Optional arguments:
256266
``SearchText``
257267
--------------
258268

259-
Atlas Search expression that performs full-text search using the :doc:`text
260-
operator <atlas:atlas-search/text>`.
269+
.. class:: SearchText(path, query, *, fuzzy=None, match_criteria=None,
270+
synonyms=None, score=None)
271+
272+
Performs full-text search using the :doc:`text operator <atlas:atlas-search/text>`.
261273

262274
This expression matches terms in the specified field and supports fuzzy
263275
matching, match criteria, and synonym mappings.
@@ -291,7 +303,9 @@ Optional arguments:
291303
``SearchWildcard``
292304
------------------
293305

294-
Atlas Search expression that matches strings using wildcard patterns.
306+
.. class:: SearchWildcard(path, query, allow_analyzed_field=None, score=None)
307+
308+
Matches strings using wildcard patterns.
295309

296310
This expression uses the
297311
:doc:`wildcard operator <atlas:atlas-search/wildcard>` to search for terms
@@ -322,8 +336,9 @@ Optional arguments:
322336
``SearchGeoShape``
323337
------------------
324338

325-
Atlas Search expression that filters documents based on spatial relationships
326-
with a geometry.
339+
.. class:: SearchGeoShape(path, relation, geometry, *, score=None)
340+
341+
Filters documents based on spatial relationships with a geometry.
327342

328343
This expression uses the
329344
:doc:`geoShape operator <atlas:atlas-search/geoShape>` to match documents
@@ -351,14 +366,15 @@ Required arguments:
351366
``"within"``, ``"intersects"``, and ``"disjoint"``.
352367
- ``geometry``: A GeoJSON geometry object to compare against.
353368

354-
An optional ``score`` :class:`SearchScoreOption` argument to tune the
369+
The optional ``score`` :class:`SearchScoreOption` argument to tune the
355370
relevance score.
356371

357372
``SearchGeoWithin``
358373
-------------------
359374

360-
Atlas Search expression that filters documents with geo fields contained
361-
within a specified shape.
375+
.. class:: SearchGeoWithin(path, kind, geometry, *, score=None)
376+
377+
Filters documents with geo fields contained within a specified shape.
362378

363379
This expression uses the
364380
:doc:`geoWithin operator <atlas:atlas-search/geoWithin>` to match documents
@@ -384,17 +400,19 @@ Required arguments:
384400
- ``kind``: The GeoJSON geometry type ``circle``, ``box``, or ``geometry``.
385401
- ``geo_object``: The GeoJSON geometry defining the spatial boundary.
386402

387-
An optional ``score`` :class:`SearchScoreOption` argument to tune the
403+
The optional ``score`` :class:`SearchScoreOption` argument to tune the
388404
relevance score.
389405

390406
``SearchMoreLikeThis``
391407
----------------------
392408

393-
Atlas Search expression that finds documents similar to the provided examples.
409+
.. class:: SearchMoreLikeThis(documents, *, score=None)
394410

395-
This expression uses the
396-
:doc:`moreLikeThis operator <atlas:atlas-search/morelikethis>` to retrieve
397-
documents that resemble one or more example documents.
411+
Finds documents similar to the provided examples.
412+
413+
This expression uses the :doc:`moreLikeThis operator
414+
<atlas:atlas-search/morelikethis>` to retrieve documents that resemble one
415+
or more example documents.
398416

399417
.. code-block:: pycon
400418
@@ -413,12 +431,15 @@ documents that resemble one or more example documents.
413431
The ``documents`` argument must be a list of example documents or expressions
414432
that serve as references for similarity.
415433

416-
An optional ``score`` :class:`SearchScoreOption` argument to tune the
434+
The optional ``score`` :class:`SearchScoreOption` argument to tune the
417435
relevance score.
418436

419437
``CompoundExpression``
420438
======================
421439

440+
.. class:: CompoundExpression(*, must=None, must_not=None, should=None,
441+
filter=None, score=None, minimum_should_match=None)
442+
422443
Compound expression that combines multiple search clauses using boolean logic.
423444

424445
This expression uses the :doc:`compound operator <atlas:atlas-search/compound>`
@@ -522,8 +543,11 @@ with other compound expressions.
522543
``SearchVector``
523544
================
524545

525-
Atlas Search expression that performs vector similarity search using the
526-
:doc:`$vectorSearch stage <atlas:atlas-vector-search/vector-search-stage>`.
546+
.. class:: SearchVector(path, query_vector, limit, *, num_candidates=None,
547+
exact=None, filter=None)
548+
549+
Performs vector similarity search using the :doc:`$vectorSearch stage
550+
<atlas:atlas-vector-search/vector-search-stage>`.
527551

528552
This expression retrieves documents whose vector field is most similar to a
529553
given query vector, using either approximate or exact nearest-neighbor search.
@@ -566,6 +590,8 @@ cannot be nested or composed.
566590
``SearchScoreOption``
567591
=====================
568592

593+
.. class:: SearchScoreOption(definitions=None)
594+
569595
Expression used to control or mutate the relevance score in an Atlas Search
570596
expression.
571597

0 commit comments

Comments
 (0)