Skip to content

Commit 3cc1e00

Browse files
committed
Polish Atlas search docs
1 parent 8c55e5b commit 3cc1e00

File tree

1 file changed

+27
-29
lines changed

1 file changed

+27
-29
lines changed

docs/source/ref/models/search.rst

Lines changed: 27 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ in a MongoDB Atlas Search index.
7777

7878
- ``path``: The document path to the field.
7979
- ``query``: The value to match.
80-
- ``fuzzy``: Fuzzy matching options, e.g., ``{"maxEdits": 1}``.
80+
- ``fuzzy``: A dictionary of fuzzy matching options, e.g., ``{"maxEdits": 1}``.
8181
- ``token_order``: Controls token sequence behavior. Accepts values like
8282
``"sequential"`` or ``"any"``.
8383
- ``score``: A :class:`SearchScoreOption` to tune the relevance score.
@@ -226,7 +226,7 @@ date, or other comparable fields based on upper and/or lower bounds.
226226

227227
Matches string fields using a regular expression.
228228

229-
Uses the :doc:`regex operator <atlas:atlas-search/regex>` to apply a regular
229+
Uses the :doc:`regex operator <atlas:atlas-search/regex>` to match a regular
230230
expression pattern to the contents of a specified field.
231231

232232
.. code-block:: pycon
@@ -241,10 +241,9 @@ expression pattern to the contents of a specified field.
241241
**Arguments:**
242242

243243
- ``path``: The document path to the field.
244-
- ``query``: Regular expression string that will be applied to the field
245-
contents.
246-
- ``allow_analyzed_field``: Boolean indicating whether to allow matching
247-
against analyzed fields.
244+
- ``query``: The regular expression to match.
245+
- ``allow_analyzed_field``: Boolean indicating whether to match against an
246+
analyzed field. ``False`` if not specified.
248247
- ``score``: A :class:`SearchScoreOption` to tune the relevance score.
249248

250249
``SearchText``
@@ -255,8 +254,8 @@ expression pattern to the contents of a specified field.
255254
Performs full-text search using the :doc:`text operator
256255
<atlas:atlas-search/text>`.
257256

258-
Matches terms in the specified field and supports fuzzy matching, match
259-
criteria, and synonym mappings.
257+
Matches terms in the specified field. Supports fuzzy matching, match criteria,
258+
and synonym mappings.
260259

261260
.. code-block:: pycon
262261
@@ -274,9 +273,8 @@ criteria, and synonym mappings.
274273
**Arguments:**
275274

276275
- ``path``: The document path to the field.
277-
- ``query``: The argument is the search term or phrase.
278-
- ``fuzzy``: A dictionary of fuzzy matching options, such as
279-
``{"maxEdits": 1}``.
276+
- ``query``: The search term or phrase.
277+
- ``fuzzy``: A dictionary of fuzzy matching options, e.g., ``{"maxEdits": 1}``.
280278
- ``match_criteria``: Whether to match ``"all"`` or ``"any"`` terms (defaults
281279
to Atlas Search behavior).
282280
- ``synonyms``: The name of a synonym mapping defined in your Atlas index.
@@ -308,8 +306,8 @@ single character) wildcards.
308306

309307
- ``path``: The document path to the field.
310308
- ``query``: A wildcard string that may include ``*`` and ``?``.
311-
- ``allow_analyzed_field``: Boolean indicating whether to allow matching
312-
against analyzed fields.
309+
- ``allow_analyzed_field``: Boolean indicating whether to match against an
310+
analyzed field. ``False`` if not specified.
313311
- ``score``: A :class:`SearchScoreOption` to tune the relevance score.
314312

315313
``SearchGeoShape``
@@ -320,8 +318,8 @@ single character) wildcards.
320318
Filters documents based on spatial relationships with a geometry.
321319

322320
Uses the :doc:`geoShape operator <atlas:atlas-search/geoShape>` to match
323-
documents where a geo field has a specified spatial relation to a given
324-
GeoJSON geometry.
321+
documents where a geo field has a specified spatial relation to a given GeoJSON
322+
geometry.
325323

326324
.. code-block:: pycon
327325
@@ -338,8 +336,8 @@ GeoJSON geometry.
338336
**Arguments:**
339337

340338
- ``path``: The document path to the field.
341-
- ``relation``: The spatial relation to test. Valid values include
342-
``"within"``, ``"intersects"``, and ``"disjoint"``.
339+
- ``relation``: The spatial relation to test. Valid values are ``"contains"``,
340+
``"disjoint"``, ``"intersects"``, and ``"within"``.
343341
- ``geometry``: A GeoJSON geometry object to compare against.
344342
- ``score``: A :class:`SearchScoreOption` to tune the relevance score.
345343

@@ -359,7 +357,7 @@ geometry.
359357
>>> from django_mongodb_backend.expressions import SearchGeoWithin
360358
>>> polygon = {"type": "Polygon", "coordinates": [[[0, 0], [3, 6], [6, 1], [0, 0]]]}
361359
>>> Article.objects.annotate(
362-
... score=SearchGeoWithin(path="location", kind="Polygon", geo_object=polygon)
360+
... score=SearchGeoWithin(path="location", kind="geometry", geo_object=polygon)
363361
... )
364362
<QuerySet [
365363
<Article: title: Local Environmental Impacts Study (location: [2, 3])>,
@@ -369,7 +367,8 @@ geometry.
369367
**Arguments:**
370368

371369
- ``path``: The document path to the field.
372-
- ``kind``: The GeoJSON geometry type ``circle``, ``box``, or ``geometry``.
370+
- ``kind``: The GeoJSON geometry type: ``"circle"``, ``"box"``, or
371+
``"geometry"``.
373372
- ``geo_object``: The GeoJSON geometry defining the spatial boundary.
374373
- ``score``: A :class:`SearchScoreOption` to tune the relevance score.
375374

@@ -399,11 +398,10 @@ retrieve documents that resemble one or more example documents.
399398
400399
**Arguments:**
401400

402-
- ``documents``: List of example documents or expressions
403-
that serve as references for similarity.
401+
- ``documents``: List of example documents or expressions that serve as
402+
references for similarity.
404403
- ``score``: A :class:`SearchScoreOption` to tune the relevance score.
405404

406-
407405
``CompoundExpression``
408406
======================
409407

@@ -442,9 +440,8 @@ contribute to document matching and scoring.
442440
match.
443441
- ``score``: A :class:`SearchScoreOption` to tune the relevance score.
444442

445-
446-
``Combinable expressions``
447-
--------------------------
443+
Combinable expressions
444+
----------------------
448445

449446
All Atlas Search expressions subclassed from ``SearchExpression``
450447
can be combined using Python's bitwise operators:
@@ -472,8 +469,8 @@ This allows for more expressive and readable search logic:
472469
Performs vector similarity search using the :doc:`$vectorSearch stage
473470
<atlas:atlas-vector-search/vector-search-stage>`.
474471

475-
Retrieves documents whose vector field is most similar to a given query
476-
vector, using either approximate or exact nearest-neighbor search.
472+
Retrieves documents whose vector field is most similar to a given query vector,
473+
using either approximate or exact nearest-neighbor search.
477474

478475
.. code-block:: pycon
479476
@@ -495,9 +492,10 @@ vector, using either approximate or exact nearest-neighbor search.
495492
- ``path``: The document path to the field.
496493
- ``query_vector``: The input vector used for similarity comparison.
497494
- ``limit``: The maximum number of matching documents to return.
498-
- ``num_candidates``: The number of candidate documents considered during
499-
search.
495+
- ``num_candidates``: The number of nearest neighbors to use during the search.
496+
Required if ``exact`` is ``False`` or omitted.
500497
- ``exact``: A boolean whether to enforce exact search instead of approximate.
498+
Required if ``num_candidates`` is omitted. If omitted, defaults to ``False``.
501499
- ``filter``: A MQL filter expression to restrict the candidate documents.
502500

503501
.. warning::

0 commit comments

Comments
 (0)