@@ -124,7 +124,7 @@ a value from the provided array.
124
124
.. code-block :: pycon
125
125
126
126
>>> 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 ]))
128
128
<QuerySet [<Article: Article object (6882f074359a4b191381b2e4)>]>
129
129
130
130
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
392
392
393
393
Required arguments:
394
394
395
- - ``kind ``: The GeoJSON geometry type, such as `` "Polygon" `` or ``"MultiPolygon" ``.
395
+ - ``kind ``: The GeoJSON geometry type `` circle ``, `` box ``, or ``geometry ``.
396
396
- ``geo_object ``: The GeoJSON geometry defining the spatial boundary.
397
397
398
398
Optional:
@@ -454,7 +454,7 @@ It enables fine-grained control over how multiple conditions contribute to docum
454
454
>>> expr1 = SearchText("headline", "mongodb")
455
455
>>> expr2 = SearchText("body", "atlas")
456
456
>>> expr3 = SearchText("body", "deprecated")
457
- >>> expr4 = SearchText("tags ", "database")
457
+ >>> expr4 = SearchText("headline ", "database")
458
458
>>> Article.objects.annotate(
459
459
... score=CompoundExpression(
460
460
... must=[expr1, expr2], must_not=[expr3], should=[expr4], minimum_should_match=1
@@ -492,6 +492,8 @@ logical operators such as ``and``, ``or``, and ``not``.
492
492
.. code-block :: pycon
493
493
494
494
>>> from django_mongodb_backend.expressions.search import CombinedSearchExpression
495
+ >>> expr1 = SearchText("headline", "mongodb")
496
+ >>> expr2 = SearchText("body", "atlas")
495
497
>>> CombinedSearchExpression(expr1, "and", expr2)
496
498
497
499
Args:
@@ -545,7 +547,7 @@ using either approximate or exact nearest-neighbor search.
545
547
... query_vector=[0.1, 0.2, 0.3],
546
548
... limit=10,
547
549
... num_candidates=100,
548
- ... exact=True ,
550
+ ... exact=False ,
549
551
... )
550
552
... )
551
553
<QuerySet [<Article: Article object (6882f074359a4b191381b2e4)>]>
@@ -584,7 +586,7 @@ It directly maps to the ``score`` option of the relevant Atlas Search operator.
584
586
>>> from django_mongodb_backend.expressions.search import SearchText, SearchScoreOption
585
587
>>> boost = SearchScoreOption({"boost": {"value": 5}})
586
588
>>> Article.objects.annotate(score=SearchText(path="body", query="django", score=boost))
587
- <QuerySet [... ]>
589
+ <QuerySet [<Article: Article object (6882f074359a4b191381b2e4)> ]>
588
590
589
591
Accepted options depend on the underlying operator and may include:
590
592
@@ -612,11 +614,8 @@ score with zero to filter matching documents.
612
614
613
615
.. code-block :: pycon
614
616
615
- >>> from django.db.models import CharField, TextField
616
- >>> from django_mongodb_backend.expressions.search import SearchTextLookup
617
-
618
- >>> # Example usage in a filter
619
617
>>> Article.objects.filter(headline__search="mongodb")
618
+ <QuerySet [<Article: Article object (6882f074359a4b191381b2e4)>]>
620
619
621
620
The lookup is automatically registered on ``CharField `` and ``TextField ``, enabling
622
621
expressions like ``fieldname__search='query' ``.
0 commit comments