Skip to content

Commit 7883c51

Browse files
committed
DOCS-4525 text index sort order
1 parent 52f4d9a commit 7883c51

File tree

3 files changed

+25
-8
lines changed

3 files changed

+25
-8
lines changed

source/core/index-text.txt

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,17 @@ Text Search and Hints
8383

8484
.. include:: /includes/fact-hint-text-query-restriction.rst
8585

86+
.. _text-index-and-sort:
87+
88+
Text Index and Sort
89+
~~~~~~~~~~~~~~~~~~~
90+
91+
Sort operations cannot obtain sort order from a ``text`` index, even
92+
from a :ref:`compound text index <text-index-compound>`; i.e. sort
93+
operations cannot use the ordering in the text index.
94+
95+
.. _text-index-compound:
96+
8697
Compound Index
8798
~~~~~~~~~~~~~~
8899

@@ -92,7 +103,10 @@ these compound indexes have the following restrictions:
92103

93104
.. include:: /includes/fact-compound-index-with-text-restrictions.rst
94105

95-
See :doc:`/tutorial/limit-number-of-items-scanned-for-text-search`.
106+
See also :ref:`text-index-and-sort` for additional limitations.
107+
108+
For an example of a compound text index, see
109+
:doc:`/tutorial/limit-number-of-items-scanned-for-text-search`.
96110

97111
.. _text-index-storage-requirements:
98112

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
A compound ``text`` index cannot include any other special index types,
2-
such as :ref:`multi-key <index-type-multi-key>` or :ref:`geospatial
3-
<index-feature-geospatial>` index fields.
1+
- A compound ``text`` index cannot include any other special index
2+
types, such as :ref:`multi-key <index-type-multi-key>` or
3+
:ref:`geospatial <index-feature-geospatial>` index fields.
44

5-
If the compound ``text`` index includes keys **preceding** the ``text``
6-
index key, to perform a :query:`$text` search, the query predicate must
7-
include **equality match conditions** on the preceding keys.
5+
- If the compound ``text`` index includes keys **preceding** the
6+
``text`` index key, to perform a :query:`$text` search, the query
7+
predicate must include **equality match conditions** on the preceding
8+
keys.

source/tutorial/limit-number-of-items-scanned-for-text-search.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ query scans only those documents with ``dept`` equal to ``kitchen``:
4848

4949
db.inventory.find( { dept: "kitchen", $text: { $search: "green" } } )
5050

51-
.. include:: /includes/fact-compound-index-with-text-restrictions.rst
51+
.. note::
52+
53+
.. include:: /includes/fact-compound-index-with-text-restrictions.rst
5254

5355
.. seealso:: :doc:`/core/index-text`

0 commit comments

Comments
 (0)