diff --git a/docs/ref/models/search.rst b/docs/ref/models/search.rst index 5eb980172..6801f59c1 100644 --- a/docs/ref/models/search.rst +++ b/docs/ref/models/search.rst @@ -36,8 +36,8 @@ For the examples in this document, we'll use the following models:: Matches documents where a field is equal to a given value. -Uses the :doc:`equals operator ` to perform exact -matches on fields indexed in a MongoDB Atlas Search index. +Uses the :doc:`equals operator` +to perform exact matches on fields indexed in a MongoDB Atlas Search index. .. code-block:: pycon @@ -58,9 +58,10 @@ matches on fields indexed in a MongoDB Atlas Search index. Enables autocomplete behavior on string fields. -Uses the :doc:`autocomplete operator ` to -match the input query against a field indexed with ``"type": "autocomplete"`` -in a MongoDB Atlas Search index. +Uses the :doc:`autocomplete operator +` to match the input +query against a field indexed with ``"type": "autocomplete"`` in a MongoDB +Atlas Search index. .. code-block:: pycon @@ -87,9 +88,9 @@ in a MongoDB Atlas Search index. Matches documents where a field exists. -Uses the :doc:`exists operator ` to check whether -the specified path is present in the document. It's useful for filtering -documents that include (or exclude) optional fields. +Uses the :doc:`exists operator` +to check whether the specified path is present in the document. It's useful for +filtering documents that include (or exclude) optional fields. .. code-block:: pycon @@ -112,8 +113,8 @@ documents that include (or exclude) optional fields. Matches documents where a field's value is in a given list. -Uses the :doc:`in operator ` to match documents whose -field contains a value from the provided array. +Uses the :doc:`in operator ` to +match documents whose field contains a value from the provided array. .. code-block:: pycon @@ -137,9 +138,9 @@ field contains a value from the provided array. Matches a phrase in the specified field. -Uses the :doc:`phrase operator ` to find exact or -near-exact sequences of terms. It supports optional slop (term distance) and -synonym mappings defined in the Atlas Search index. +Uses the :doc:`phrase operator` +to find exact or near-exact sequences of terms. It supports optional slop (term +distance) and synonym mappings defined in the Atlas Search index. .. code-block:: pycon @@ -167,9 +168,10 @@ synonym mappings defined in the Atlas Search index. Matches using a Lucene-style query string. -Uses the :doc:`queryString operator ` to parse -and execute full-text queries written in a simplified Lucene syntax. It -supports features like boolean operators, wildcards, and field-specific terms. +Uses the :doc:`queryString operator +` to parse and execute +full-text queries written in a simplified Lucene syntax. It supports features +like boolean operators, wildcards, and field-specific terms. .. code-block:: pycon @@ -196,8 +198,9 @@ supports features like boolean operators, wildcards, and field-specific terms. Filters documents within a specified range of values. -Uses the :doc:`range operator ` to match numeric, -date, or other comparable fields based on upper and/or lower bounds. +Uses the :doc:`range operator ` +to match numeric, date, or other comparable fields based on upper and/or lower +bounds. .. code-block:: pycon @@ -224,8 +227,8 @@ date, or other comparable fields based on upper and/or lower bounds. Matches string fields using a regular expression. -Uses the :doc:`regex operator ` to match a regular -expression pattern to the contents of a specified field. +Uses the :doc:`regex operator ` +to match a regular expression pattern to the contents of a specified field. .. code-block:: pycon @@ -250,7 +253,7 @@ expression pattern to the contents of a specified field. .. class:: SearchText(path, query, *, fuzzy=None, match_criteria=None, synonyms=None, score=None) Performs full-text search using the :doc:`text operator -`. +`. Matches terms in the specified field. Supports fuzzy matching, match criteria, and synonym mappings. @@ -285,8 +288,9 @@ and synonym mappings. Matches strings using wildcard patterns. -Uses the :doc:`wildcard operator ` to search for -terms matching a pattern with ``*`` (any sequence of characters) and ``?`` (any +Uses the :doc:`wildcard operator +` to search for terms +matching a pattern with ``*`` (any sequence of characters) and ``?`` (any single character) wildcards. .. code-block:: pycon @@ -315,9 +319,9 @@ single character) wildcards. Filters documents based on spatial relationships with a geometry. -Uses the :doc:`geoShape operator ` to match -documents where a geo field has a specified spatial relation to a given GeoJSON -geometry. +Uses the :doc:`geoShape operator +` to match documents where a +geo field has a specified spatial relation to a given GeoJSON geometry. .. code-block:: pycon @@ -346,9 +350,9 @@ geometry. Filters documents with geo fields contained within a specified shape. -Uses the :doc:`geoWithin operator ` to match -documents where the geo field lies entirely within the provided GeoJSON -geometry. +Uses the :doc:`geoWithin operator +` to match documents where +the geo field lies entirely within the provided GeoJSON geometry. .. code-block:: pycon @@ -377,8 +381,9 @@ geometry. Finds documents similar to the provided examples. -Uses the :doc:`moreLikeThis operator ` to -retrieve documents that resemble one or more example documents. +Uses the :doc:`moreLikeThis operator +` to retrieve documents +that resemble one or more example documents. .. code-block:: pycon @@ -407,10 +412,11 @@ retrieve documents that resemble one or more example documents. Compound expression that combines multiple search clauses using boolean logic. -Uses the :doc:`compound operator ` to combine -sub-expressions with ``must``, ``must_not``, ``should``, and ``filter`` -clauses. It enables fine-grained control over how multiple conditions -contribute to document matching and scoring. +Uses the :doc:`compound operator +` to combine sub-expressions +with ``must``, ``must_not``, ``should``, and ``filter`` clauses. It enables +fine-grained control over how multiple conditions contribute to document +matching and scoring. .. code-block:: pycon @@ -537,7 +543,7 @@ The ``search`` lookup Use the ``search`` lookup on :class:`~django.db.models.CharField` and :class:`~django.db.models.TextField` to perform full-text searches using the -:doc:`text operator `: +:doc:`text operator `: .. code-block:: pycon