Skip to content

Commit d6e2594

Browse files
committed
Readd operators title and TOC in true
1 parent 4036567 commit d6e2594

File tree

2 files changed

+107
-122
lines changed

2 files changed

+107
-122
lines changed

docs/source/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,4 @@
5353

5454
html_theme = "furo"
5555
html_static_path = ["_static"]
56+
toc_object_entries = False

docs/source/ref/models/search.rst

Lines changed: 106 additions & 122 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ For the examples in this document, we'll use the following models::
3131
plot_embedding = ArrayField(models.FloatField(), size=3, null=True)
3232
writer = EmbeddedModelField(Writer, null=True)
3333

34+
``SearchEquals``
35+
----------------
36+
3437
.. class:: SearchEquals(path, value, *, score=None)
3538

3639
Matches documents where a field is equal to a given value.
@@ -46,13 +49,12 @@ matches on fields indexed in a MongoDB Atlas Search index.
4649
4750
**Arguments:**
4851

49-
- ``path`` (``str`` or :class:`~django.db.models.F`): The document path
50-
to the field.
51-
- ``value`` (``bool``, :class:`~bson.objectid.ObjectId`, ``int``,
52-
:class:`~datetime.datetime`, ``str``, :class:`~uuid.UUID`, ``None``, or
53-
:class:`~django.db.models.Value`): The value to match.
54-
- ``score`` (:class:`~typing.Optional`\[:class:`SearchScoreOption`\]):
55-
Tunes the relevance score.
52+
- ``path``: The document path to the field.
53+
- ``value``: The value to match.
54+
- ``score``: A :class:`SearchScoreOption` to tune the relevance score.
55+
56+
``SearchAutocomplete``
57+
----------------------
5658

5759
.. class:: SearchAutocomplete(path, query, *, fuzzy=None, token_order=None, score=None)
5860

@@ -73,15 +75,15 @@ in a MongoDB Atlas Search index.
7375
7476
**Arguments:**
7577

76-
- ``path`` (``str`` or :class:`~django.db.models.F`): The document path
77-
to the field.
78-
- ``query`` (``str``, :class:`~django.db.models.Value`): The value to match.
79-
- ``fuzzy`` (:class:`~typing.Optional`\[:class:`~typing.Dict`\]): Fuzzy
80-
matching options, e.g., ``{"maxEdits": 1}``.
78+
- ``path``: The document path to the field.
79+
- ``query``: The value to match.
80+
- ``fuzzy``: Fuzzy matching options, e.g., ``{"maxEdits": 1}``.
8181
- ``token_order``: Controls token sequence behavior. Accepts values like
8282
``"sequential"`` or ``"any"``.
83-
- ``score`` (:class:`~typing.Optional`\[:class:`SearchScoreOption`\]):
84-
Tunes the relevance score.
83+
- ``score``: A :class:`SearchScoreOption` to tune the relevance score.
84+
85+
``SearchExists``
86+
----------------
8587

8688
.. class:: SearchExists(path, *, score=None)
8789

@@ -102,10 +104,11 @@ documents that include (or exclude) optional fields.
102104
103105
**Arguments:**
104106

105-
- ``path`` (``str`` or :class:`~django.db.models.F`): The document path
106-
to the field.
107-
- ``score`` (:class:`~typing.Optional`\[:class:`SearchScoreOption`\]):
108-
Tunes the relevance score.
107+
- ``path``: The document path to the field.
108+
- ``score``: A :class:`SearchScoreOption` to tune the relevance score.
109+
110+
``SearchIn``
111+
------------
109112

110113
.. class:: SearchIn(path, value, *, score=None)
111114

@@ -125,13 +128,12 @@ field contains a value from the provided array.
125128
126129
**Arguments:**
127130

128-
- ``path`` (``str`` or :class:`~django.db.models.F`): The document path
129-
to the field.
130-
- ``value`` (``bool``, ``int``, ``str``, :class:`~bson.objectid.ObjectId`,
131-
:class:`~datetime.datetime`, :class:`~uuid.UUID`, or
132-
:class:`~django.db.models.Value`): The value to match.
133-
- ``score`` (:class:`~typing.Optional`\[:class:`SearchScoreOption`\]):
134-
Tunes the relevance score.
131+
- ``path``: The document path to the field.
132+
- ``value``: The value to match.
133+
- ``score``: A :class:`SearchScoreOption` to tune the relevance score.
134+
135+
``SearchPhrase``
136+
----------------
135137

136138
.. class:: SearchPhrase(path, query, *, slop=None, synonyms=None, score=None)
137139

@@ -154,16 +156,14 @@ synonym mappings defined in the Atlas Search index.
154156
155157
**Arguments:**
156158

157-
- ``path`` (``str`` or :class:`~django.db.models.F`): The document path
158-
to the field.
159-
- ``query`` (``str``, :class:`~django.db.models.Value`): The value to match.
160-
- ``slop`` (``Optional[int]``): The maximum number of
161-
terms allowed between phrase terms.
162-
- ``synonyms`` (``Optional[str]``): The name of a synonym
163-
mapping defined in your Atlas index.
164-
- ``score`` (:class:`~typing.Optional`\[:class:`SearchScoreOption`\]):
165-
Tunes the relevance score.
159+
- ``path``: The document path to the field.
160+
- ``query``: The value to match.
161+
- ``slop``: The maximum number of terms allowed between phrase terms.
162+
- ``synonyms``: The name of a synonym mapping defined in your Atlas index.
163+
- ``score``: A :class:`SearchScoreOption` to tune the relevance score.
166164

165+
``SearchQueryString``
166+
---------------------
167167

168168
.. class:: SearchQueryString(path, query, *, score=None)
169169

@@ -186,12 +186,13 @@ supports features like boolean operators, wildcards, and field-specific terms.
186186
187187
**Arguments:**
188188

189-
- ``path`` (``str`` or :class:`~django.db.models.F`): The document path
190-
to the field.
191-
- ``query`` (``str``, :class:`~django.db.models.Value`): argument is a
192-
Lucene-style query string.
193-
- ``score`` (:class:`~typing.Optional`\[:class:`SearchScoreOption`\]): Tunes
194-
the relevance score.
189+
- ``path``: The document path to the field.
190+
- ``query``: A Lucene-style query string.
191+
- ``score``: A :class:`SearchScoreOption` to tune the relevance score.
192+
193+
194+
``SearchRange``
195+
---------------
195196

196197
.. class:: SearchRange(path, *, lt=None, lte=None, gt=None, gte=None, score=None)
197198

@@ -211,22 +212,15 @@ date, or other comparable fields based on upper and/or lower bounds.
211212
212213
**Arguments:**
213214

214-
- ``path`` (``str`` or :class:`~django.db.models.F`): The document path
215-
to the field.
216-
- ``lt`` (``bool``, :class:`~bson.objectid.ObjectId`, ``int``,
217-
:class:`~datetime.datetime`, ``str``, :class:`~uuid.UUID`, or
218-
:class:`~django.db.models.Value`): Exclusive upper bound (``<``)
219-
- ``lte`` (``bool``, :class:`~bson.objectid.ObjectId`, ``int``,
220-
:class:`~datetime.datetime`, ``str``, :class:`~uuid.UUID`, or
221-
:class:`~django.db.models.Value`): Inclusive upper bound (``<=``)
222-
- ``gt`` (``bool``, :class:`~bson.objectid.ObjectId`, ``int``,
223-
:class:`~datetime.datetime`, ``str``, :class:`~uuid.UUID`, or
224-
:class:`~django.db.models.Value`): Exclusive lower bound (``>``)
225-
- ``gte`` (``bool``, :class:`~bson.objectid.ObjectId`, ``int``,
226-
:class:`~datetime.datetime`, ``str``, :class:`~uuid.UUID`, or
227-
:class:`~django.db.models.Value`): Inclusive lower bound (``>=``)
228-
- ``score`` (:class:`~typing.Optional`\[:class:`SearchScoreOption`\]):
229-
Tunes the relevance score.
215+
- ``path``: The document path to the field.
216+
- ``lt``: Exclusive upper bound (``<``)
217+
- ``lte``: Inclusive upper bound (``<=``)
218+
- ``gt``: Exclusive lower bound (``>``)
219+
- ``gte``: Inclusive lower bound (``>=``)
220+
- ``score``: A :class:`SearchScoreOption` to tune the relevance score.
221+
222+
``SearchRegex``
223+
---------------
230224

231225
.. class:: SearchRegex(path, query, *, allow_analyzed_field=None, score=None)
232226

@@ -246,14 +240,15 @@ expression pattern to the contents of a specified field.
246240
247241
**Arguments:**
248242

249-
- ``path`` (``str`` or :class:`~django.db.models.F`): The document path
250-
to the field.
251-
- ``query`` (``str``, :class:`~django.db.models.Value`): regular expression
252-
string that will be applied to the field contents.
253-
- ``allow_analyzed_field`` (``Optional[bool]``): Boolean
254-
indicating whether to allow matching against analyzed fields.
255-
- ``score`` (:class:`~typing.Optional`\[:class:`SearchScoreOption`\]):
256-
Tunes the relevance score.
243+
- ``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.
248+
- ``score``: A :class:`SearchScoreOption` to tune the relevance score.
249+
250+
``SearchText``
251+
--------------
257252

258253
.. class:: SearchText(path, query, *, fuzzy=None, match_criteria=None, synonyms=None, score=None)
259254

@@ -278,17 +273,15 @@ criteria, and synonym mappings.
278273
279274
**Arguments:**
280275

281-
- ``path`` (``str`` or :class:`~django.db.models.F`): The document path
282-
to the field.
283-
- ``query`` (``str``, :class:`~django.db.models.Value`): argument
284-
is the search term or phrase.
285-
- ``fuzzy`` (``Optional[Dict]``): A dictionary of fuzzy
286-
matching options, such as ``{"maxEdits": 1}``.
287-
- ``synonyms`` (``Optional[str]``): The name of a synonym
288-
mapping defined in your Atlas index.
289-
- ``score`` (:class:`~typing.Optional`\[:class:`SearchScoreOption`\]):
290-
Tunes the relevance score.
276+
- ``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}``.
280+
- ``synonyms``: The name of a synonym mapping defined in your Atlas index.
281+
- ``score``: A :class:`SearchScoreOption` to tune the relevance score.
291282

283+
``SearchWildcard``
284+
------------------
292285

293286
.. class:: SearchWildcard(path, query, allow_analyzed_field=None, score=None)
294287

@@ -311,14 +304,14 @@ terms matching a pattern with ``*`` (any sequence of characters) and ``?``
311304
312305
**Arguments:**
313306

314-
- ``path`` (``str`` or :class:`~django.db.models.F`): The document path
315-
to the field.
316-
- ``query`` (``str``, :class:`~django.db.models.Value`): is a wildcard string
317-
that may include ``*`` and ``?``.
318-
- ``allow_analyzed_field`` (``Optional[bool]``): Boolean
319-
indicating whether to allow matching against analyzed fields.
320-
- ``score`` (:class:`~typing.Optional`\[:class:`SearchScoreOption`\]):
321-
Tunes the relevance score.
307+
- ``path``: The document path to the field.
308+
- ``query``: A wildcard string that may include ``*`` and ``?``.
309+
- ``allow_analyzed_field``: Boolean indicating whether to allow matching
310+
against analyzed fields.
311+
- ``score``: A :class:`SearchScoreOption` to tune the relevance score.
312+
313+
``SearchGeoShape``
314+
------------------
322315

323316
.. class:: SearchGeoShape(path, relation, geometry, *, score=None)
324317

@@ -342,14 +335,14 @@ GeoJSON geometry.
342335
343336
**Arguments:**
344337

345-
- ``path`` (``str`` or :class:`~django.db.models.F`): The document path
346-
to the field.
347-
- ``relation`` (``str``): The spatial relation to test. Valid
348-
values include ``"within"``, ``"intersects"``, and ``"disjoint"``.
349-
- ``geometry`` (``Dict``): A GeoJSON geometry object to compare against.
350-
- ``score`` (:class:`~typing.Optional`\[:class:`SearchScoreOption`\]):
351-
Tunes the relevance score.
338+
- ``path``: The document path to the field.
339+
- ``relation``: The spatial relation to test. Valid values include
340+
``"within"``, ``"intersects"``, and ``"disjoint"``.
341+
- ``geometry``: A GeoJSON geometry object to compare against.
342+
- ``score``: A :class:`SearchScoreOption` to tune the relevance score.
352343

344+
``SearchGeoWithin``
345+
-------------------
353346

354347
.. class:: SearchGeoWithin(path, kind, geometry, *, score=None)
355348

@@ -373,15 +366,13 @@ geometry.
373366
374367
**Arguments:**
375368

376-
- ``path`` (``str`` or :class:`~django.db.models.F`): The document path
377-
to the field.
378-
- ``kind`` (``str``): The GeoJSON geometry type ``circle``, ``box``, or
379-
``geometry``.
380-
- ``geo_object`` (``Dict``): The GeoJSON geometry defining the spatial
381-
boundary.
382-
- ``score`` (:class:`~typing.Optional`\[:class:`SearchScoreOption`\]):
383-
Tunes the relevance score.
369+
- ``path``: The document path to the field.
370+
- ``kind``: The GeoJSON geometry type ``circle``, ``box``, or ``geometry``.
371+
- ``geo_object``: The GeoJSON geometry defining the spatial boundary.
372+
- ``score``: A :class:`SearchScoreOption` to tune the relevance score.
384373

374+
``SearchMoreLikeThis``
375+
----------------------
385376

386377
.. class:: SearchMoreLikeThis(documents, *, score=None)
387378

@@ -406,10 +397,9 @@ retrieve documents that resemble one or more example documents.
406397
407398
**Arguments:**
408399

409-
- ``documents`` (``List[Dict]``): List of example documents or expressions
400+
- ``documents``: List of example documents or expressions
410401
that serve as references for similarity.
411-
- ``score`` (:class:`~typing.Optional`\[:class:`SearchScoreOption`\]):
412-
Tunes the relevance score.
402+
- ``score``: A :class:`SearchScoreOption` to tune the relevance score.
413403

414404

415405
``CompoundExpression``
@@ -440,21 +430,19 @@ contribute to document matching and scoring.
440430
441431
**Arguments:**
442432

443-
- ``must`` (``List[SearchExpression])``): List of expressions that **must**
433+
- ``must``: List of expressions that **must** match.
434+
- ``must_not``: List of expressions that **must not** match.
435+
- ``should``: List of optional expressions that **should** match. These can
436+
improve scoring.
437+
- ``filter``: List of expressions used for filtering without affecting
438+
relevance scoring.
439+
- ``minimum_should_match``: The minimum number of ``should`` clauses that must
444440
match.
445-
- ``must_not`` (``List[SearchExpression]``): List of expressions that
446-
**must not** match.
447-
- ``should`` (``List[SearchExpression]``): List of optional expressions that
448-
**should** match. These can improve scoring.
449-
- ``filter`` (``List[SearchExpression]``): List of expressions used for
450-
filtering without affecting relevance scoring.
451-
- ``minimum_should_match`` (``Optional[int]``): The minimum number of
452-
``should`` clauses that must match.
453441
- ``score``: A :class:`SearchScoreOption` to tune the relevance score.
454442

455443

456-
Combinable expressions
457-
----------------------
444+
``Combinable expressions``
445+
--------------------------
458446

459447
All Atlas Search expressions subclassed from ``SearchExpression``
460448
can be combined using Python's bitwise operators:
@@ -502,17 +490,13 @@ vector, using either approximate or exact nearest-neighbor search.
502490
503491
**Arguments:**
504492

505-
- ``path`` (``str`` or :class:`~django.db.models.F`): The document path
506-
to the field.
507-
- ``query_vector`` (``List[float | int]``): The input vector used for
508-
similarity comparison.
509-
- ``limit`` (``int``): The maximum number of matching documents to return.
510-
- ``num_candidates`` (``int``): The number of candidate documents considered
511-
during search.
512-
- ``exact`` (``bool``): Whether to enforce exact search instead of
513-
approximate.
514-
- ``filter`` (``dict``): A filter MQL expression to restrict the candidate
515-
documents.
493+
- ``path``: The document path to the field.
494+
- ``query_vector``: The input vector used for similarity comparison.
495+
- ``limit``: The maximum number of matching documents to return.
496+
- ``num_candidates``: The number of candidate documents considered during
497+
search.
498+
- ``exact``: A boolean whether to enforce exact search instead of approximate.
499+
- ``filter``: A MQL filter expression to restrict the candidate documents.
516500

517501
.. warning::
518502

0 commit comments

Comments
 (0)