Skip to content

Commit 2b8e2b0

Browse files
committed
doc edits
1 parent 99f6548 commit 2b8e2b0

File tree

2 files changed

+35
-51
lines changed

2 files changed

+35
-51
lines changed

docs/source/ref/models/search.rst

Lines changed: 34 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
1-
================
1+
============
22
Atlas search
3-
================
3+
============
44

5-
The database functions in the ``django_mongodb_backend.expressions.search``
6-
module ease the use of MongoDB Atlas search's `full text and vector search
7-
engine <https://www.mongodb.com/docs/atlas/atlas-search/>`_.
5+
.. currentmodule:: django_mongodb_backend.expressions
86

9-
For the examples in this document, we'll use the following models:
7+
.. versionadded:: 5.2.0b2
108

11-
.. code-block:: pycon
9+
The database functions in the ``django_mongodb_backend.expressions.search``
10+
module ease the use of MongoDB Atlas search's :doc:`full text and vector search
11+
engine <atlas:atlas-search>`.
12+
13+
For the examples in this document, we'll use the following models::
1214

1315
from django.db import models
1416
from django_mongodb_backend.models import EmbeddedModel
1517
from django_mongodb_backend.fields import ArrayField, EmbeddedModelField
1618

19+
1720
class Writer(EmbeddedModel):
1821
name = models.CharField(max_length=10)
1922

@@ -26,17 +29,15 @@ For the examples in this document, we'll use the following models:
2629
plot_embedding = ArrayField(models.FloatField(), size=3, null=True)
2730
writer = EmbeddedModelField(Writer, null=True)
2831

29-
3032
``SearchEquals``
3133
================
32-
Atlas Search expression that matches documents where a field is equal to a
33-
given value.
3434

35-
This expression uses the ``equals`` operator to perform exact matches
36-
on fields indexed in a MongoDB Atlas Search index.
35+
.. class:: SearchEquals(path, value, score=None)
3736

38-
`SearchEquals docs <https://www.mongodb.com/docs/atlas/atlas-search/equals/>`_
37+
Atlas Search expression that matches documents where a field is equal to a given value.
3938

39+
This expression uses the :doc:`equals operator <atlas:atlas-search/equals>` to perform
40+
exact matches on fields indexed in a MongoDB Atlas Search index.
4041

4142
.. code-block:: pycon
4243
@@ -48,11 +49,9 @@ The ``path`` argument can be either the name of a field (as a string), or a
4849
:class:`~django.db.models.expressions.Col` instance. The ``value`` argument
4950
must be a string or a :class:`~django.db.models.expressions.Value`.
5051

51-
``SearchEquals`` objects can be reused and combined with other search
52-
expressions.
53-
54-
See :ref:`search-operations-combinable`
52+
``SearchEquals`` objects can be reused and combined with other search expressions.
5553

54+
See :ref:`search-operations-combinable`.
5655

5756
``SearchAutocomplete``
5857
======================
@@ -90,8 +89,7 @@ Optional arguments:
9089
``SearchAutocomplete`` expressions can be reused and composed with other
9190
search expressions.
9291

93-
See also: :ref:`search-operations-combinable`
94-
92+
See also: :ref:`search-operations-combinable`.
9593

9694
``SearchExists``
9795
================
@@ -122,8 +120,7 @@ result.
122120
``SearchExists`` expressions can be reused and combined with other search
123121
expressions.
124122

125-
See also: :ref:`search-operations-combinable`
126-
123+
See also: :ref:`search-operations-combinable`.
127124

128125
``SearchIn``
129126
============
@@ -154,8 +151,7 @@ An optional ``score`` argument can be used to customize relevance scoring.
154151
``SearchIn`` expressions can be reused and combined with other search
155152
expressions.
156153

157-
See also: :ref:`search-operations-combinable`
158-
154+
See also: :ref:`search-operations-combinable`.
159155

160156
``SearchPhrase``
161157
================
@@ -192,8 +188,7 @@ Optional arguments:
192188
``SearchPhrase`` expressions can be reused and combined with other search
193189
expressions.
194190

195-
See also: :ref:`search-operations-combinable`
196-
191+
See also: :ref:`search-operations-combinable`.
197192

198193
``SearchQueryString``
199194
=====================
@@ -226,8 +221,7 @@ An optional ``score`` argument may be used to adjust relevance scoring.
226221
``SearchQueryString`` expressions can be reused and combined with other search
227222
expressions.
228223

229-
See also: :ref:`search-operations-combinable`
230-
224+
See also: :ref:`search-operations-combinable`.
231225

232226
``SearchRange``
233227
===============
@@ -263,8 +257,7 @@ Optional arguments:
263257
``SearchRange`` expressions can be reused and combined with other search
264258
expressions.
265259

266-
See also: :ref:`search-operations-combinable`
267-
260+
See also: :ref:`search-operations-combinable`.
268261

269262
``SearchRegex``
270263
===============
@@ -298,8 +291,7 @@ Optional arguments:
298291
``SearchRegex`` expressions can be reused and combined with other search
299292
expressions.
300293

301-
See also: :ref:`search-operations-combinable`
302-
294+
See also: :ref:`search-operations-combinable`.
303295

304296
``SearchText``
305297
==============
@@ -343,7 +335,6 @@ Optional arguments:
343335

344336
See also: :ref:`search-operations-combinable`
345337

346-
347338
``SearchWildcard``
348339
==================
349340

@@ -353,7 +344,7 @@ This expression uses the ``wildcard`` operator to search for terms matching
353344
a pattern with ``*`` (any sequence of characters) and ``?`` (any single
354345
character) wildcards.
355346

356-
`SearchWildcard docs <https://www.mongodb.com/docs/atlas/atlas-search/wildcard/>`_
347+
`SearchWildcard docs <https://www.mongodb.com/docs/atlas/atlas-search/wildcard/>`_.
357348

358349
.. code-block:: pycon
359350
@@ -379,19 +370,18 @@ Optional arguments:
379370
``SearchWildcard`` expressions can be reused and combined with other search
380371
expressions.
381372

382-
See also: :ref:`search-operations-combinable`
383-
373+
See also: :ref:`search-operations-combinable`.
384374

385375
``SearchGeoShape``
386376
==================
387377

388378
Atlas Search expression that filters documents based on spatial relationships
389379
with a geometry.
390380

391-
This expression uses the ``geoShape`` operator to match documents where a geo
381+
This expression uses the :doc:geoShape operator <atlas:atlas-search/geoShape>` to match documents where a geo
392382
field has a specified spatial relation to a given GeoJSON geometry.
393383

394-
`SearchGeoShape docs <https://www.mongodb.com/docs/atlas/atlas-search/geoShape/>`_
384+
`SearchGeoShape docs <https://www.mongodb.com/docs/atlas/atlas-search/geoShape/>`_.
395385

396386
.. code-block:: pycon
397387
@@ -421,8 +411,7 @@ Optional:
421411
``SearchGeoShape`` expressions can be reused and combined with other search
422412
expressions.
423413

424-
See also: :ref:`search-operations-combinable`
425-
414+
See also: :ref:`search-operations-combinable`.
426415

427416
``SearchGeoWithin``
428417
===================
@@ -462,8 +451,7 @@ Optional:
462451
``SearchGeoWithin`` expressions can be reused and combined with other search
463452
expressions.
464453

465-
See also: :ref:`search-operations-combinable`
466-
454+
See also: :ref:`search-operations-combinable`.
467455

468456
``SearchMoreLikeThis``
469457
======================
@@ -500,8 +488,7 @@ Optional:
500488
``SearchMoreLikeThis`` expressions can be reused and combined with other search
501489
expressions.
502490

503-
See also: :ref:`search-operations-combinable`
504-
491+
See also: :ref:`search-operations-combinable`.
505492

506493
``CompoundExpression``
507494
======================
@@ -544,8 +531,7 @@ Arguments:
544531
``CompoundExpression`` is useful for building advanced and flexible query
545532
logic in Atlas Search.
546533

547-
See also: :ref:`search-operations-combinable`
548-
534+
See also: :ref:`search-operations-combinable`.
549535

550536
``CombinedSearchExpression``
551537
============================
@@ -598,8 +584,8 @@ Atlas Search expressions.
598584

599585
.. _search-operations-combinable:
600586

601-
**Combinable expressions**
602-
--------------------------
587+
Combinable expressions
588+
----------------------
603589

604590
All Atlas Search expressions subclassed from ``SearchExpression``
605591
can be combined using Python's bitwise operators:
@@ -672,7 +658,6 @@ Arguments:
672658
``SearchVector`` is typically used on its own in the ``score`` annotation and
673659
cannot be nested or composed.
674660

675-
676661
``SearchScoreOption``
677662
=====================
678663

@@ -706,7 +691,6 @@ subdocument and can be reused across multiple search expressions.
706691
It is typically passed as the ``score`` parameter to any search expression that
707692
supports it.
708693

709-
710694
The ``search`` lookup
711695
======================
712696

@@ -735,7 +719,7 @@ Under the hood:
735719

736720
- The left-hand side of the lookup is wrapped into a ``SearchText`` expression.
737721
- The lookup compiles to a MongoDB query that filters documents with a score
738-
greater or equal to zero.
722+
greater or equal to zero.
739723

740724
This allows for concise and idiomatic integration of Atlas Search within Django
741725
filters.

docs/source/releases/5.2.x.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ New features
1717
:class:`~.fields.PolymorphicEmbeddedModelArrayField` for storing a model
1818
instance or list of model instances that may be of more than one model class.
1919
- Added support for MongoDB Atlas Search expressions, including
20-
``SearchAutocomplete``, ``SearchEquals``, ``SearchVector``, and others.
20+
``SearchAutocomplete``, :class:`.SearchEquals`, ``SearchVector``, and others.
2121
- Added support for the ``search`` lookup on
2222
:class:`~django.db.models.TextField` and
2323
:class:`~django.db.models.CharField`.

0 commit comments

Comments
 (0)