Skip to content

Commit d65da2a

Browse files
committed
Edit docs.
1 parent aee4c1b commit d65da2a

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

docs/source/ref/models/search.rst

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ a value from the provided array.
124124
.. code-block:: pycon
125125
126126
>>> from django_mongodb_backend.expressions.search import SearchIn
127-
>>> Article.objects.annotate(score=SearchIn(path="status", value=["pending", "approved"]))
127+
>>> Article.objects.annotate(score=SearchIn(path="number", value=[1, 2]))
128128
<QuerySet [<Article: Article object (6882f074359a4b191381b2e4)>]>
129129
130130
The ``path`` argument can be the name of a field (as a string) or a
@@ -392,7 +392,7 @@ The ``path`` argument specifies the geo field to filter and can be a string or a
392392

393393
Required arguments:
394394

395-
- ``kind``: The GeoJSON geometry type, such as ``"Polygon"`` or ``"MultiPolygon"``.
395+
- ``kind``: The GeoJSON geometry type ``circle``, ``box``, or ``geometry``.
396396
- ``geo_object``: The GeoJSON geometry defining the spatial boundary.
397397

398398
Optional:
@@ -454,7 +454,7 @@ It enables fine-grained control over how multiple conditions contribute to docum
454454
>>> expr1 = SearchText("headline", "mongodb")
455455
>>> expr2 = SearchText("body", "atlas")
456456
>>> expr3 = SearchText("body", "deprecated")
457-
>>> expr4 = SearchText("tags", "database")
457+
>>> expr4 = SearchText("headline", "database")
458458
>>> Article.objects.annotate(
459459
... score=CompoundExpression(
460460
... must=[expr1, expr2], must_not=[expr3], should=[expr4], minimum_should_match=1
@@ -492,6 +492,8 @@ logical operators such as ``and``, ``or``, and ``not``.
492492
.. code-block:: pycon
493493
494494
>>> from django_mongodb_backend.expressions.search import CombinedSearchExpression
495+
>>> expr1 = SearchText("headline", "mongodb")
496+
>>> expr2 = SearchText("body", "atlas")
495497
>>> CombinedSearchExpression(expr1, "and", expr2)
496498
497499
Args:
@@ -545,7 +547,7 @@ using either approximate or exact nearest-neighbor search.
545547
... query_vector=[0.1, 0.2, 0.3],
546548
... limit=10,
547549
... num_candidates=100,
548-
... exact=True,
550+
... exact=False,
549551
... )
550552
... )
551553
<QuerySet [<Article: Article object (6882f074359a4b191381b2e4)>]>
@@ -584,7 +586,7 @@ It directly maps to the ``score`` option of the relevant Atlas Search operator.
584586
>>> from django_mongodb_backend.expressions.search import SearchText, SearchScoreOption
585587
>>> boost = SearchScoreOption({"boost": {"value": 5}})
586588
>>> Article.objects.annotate(score=SearchText(path="body", query="django", score=boost))
587-
<QuerySet [...]>
589+
<QuerySet [<Article: Article object (6882f074359a4b191381b2e4)>]>
588590
589591
Accepted options depend on the underlying operator and may include:
590592

@@ -612,11 +614,8 @@ score with zero to filter matching documents.
612614

613615
.. code-block:: pycon
614616
615-
>>> from django.db.models import CharField, TextField
616-
>>> from django_mongodb_backend.expressions.search import SearchTextLookup
617-
618-
>>> # Example usage in a filter
619617
>>> Article.objects.filter(headline__search="mongodb")
618+
<QuerySet [<Article: Article object (6882f074359a4b191381b2e4)>]>
620619
621620
The lookup is automatically registered on ``CharField`` and ``TextField``, enabling
622621
expressions like ``fieldname__search='query'``.

0 commit comments

Comments
 (0)