Skip to content

copy edits to text-search #747

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions source/applications/text-search.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Create a ``text`` Index

To perform text search, create a ``text`` index on the field or fields
whose value is a string or an array of string elements. To create a
``text`` indexes, use the :method:`db.collection.ensureIndex()` method
``text`` index, use the :method:`db.collection.ensureIndex()` method
with a document that contains field and value pairs where the value is
the string literal ``text``.

Expand Down Expand Up @@ -66,10 +66,10 @@ This ``text`` index catalogs all string data in the ``subject`` field
and the ``content`` field, where the field value is either a string or
an array of string elements.

See :doc:`/core/text-index` for details on the options available when
See :doc:`/core/text-indexes` for details on the options available when
creating ``text`` indexes.

Additionally, ``text`` indexes can also be combined with
Additionally, ``text`` indexes can be combined with
ascending/descending index fields. See:

- :doc:`/tutorial/limit-number-of-items-scanned-for-text-search`
Expand All @@ -87,9 +87,9 @@ document field contains the word ``blueberry``, a search on the term
``blue`` will not match the document. However, a search on either
``blueberry`` or ``blueberries`` will match.

By default, the :dbcommand:`text` returns the top 100 scoring documents
in descending order, but you can specify a ``limit`` option to change
the maximum number to return.
By default, the :dbcommand:`text` command returns the top 100 scoring
documents in descending order, but you can specify a ``limit`` option
to change the maximum number to return.

Given a collection with a ``text`` index, use the
:method:`~db.collection.runCommand()` method to execute the
Expand Down
12 changes: 6 additions & 6 deletions source/core/indexes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -789,27 +789,27 @@ MongoDB provides ``text`` indexes to support :doc:`text search

``text`` indexes are case-insensitive and can include any field that
contains string data. ``text`` indexes drop language-specific stop
words (e.g. in English, the,” “an,” “a,” “and, etc.) and uses simple
words (e.g. in English, "the," "an," "a," "and," etc.) and uses simple
language-specific suffix stemming. See :ref:`text-search-languages` for
the supported languages.

``text`` indexes have the following storage requirements and
performance costs:

- Text indexes change the space allocation method for all future
- ``text`` indexes change the space allocation method for all future
record allocations in a collection to :collflag:`usePowerOf2Sizes`.

- Text indexes can be large. They contain one index entry for each
- ``text`` indexes can be large. They contain one index entry for each
unique post-stemmed word in each indexed field for each document
inserted.

- Building a ``text`` index is very similar to building a large
multi-key index, and will take longer than building a simple ordered
multi-key index and will take longer than building a simple ordered
(scalar) index on the same data.

- When building a large ``text`` index on an existing collection,
ensure that you have a sufficiently-high open file descriptor limit.
See the :ref:`recommended settings <oom-killer>`.
ensure that you have a sufficiently high limit on open file
descriptors. See the :ref:`recommended settings <oom-killer>`.

- ``text`` indexes will impact insertion throughput because MongoDB
must add an index entry for each unique post-stemmed word in each
Expand Down
20 changes: 12 additions & 8 deletions source/core/text-indexes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ creating ``text`` indexes.
Specify a Name for the ``text`` Index
-------------------------------------

The default name for the index consists of each index field name
concatenated with ``_text``. Consider the ``text`` index on the fields
``content``, ``users.comments``, and ``users.profiles``.
The default name for the index consists of each indexed field name
concatenated with ``_text``. For example, the following command creates
a ``text`` index on the fields ``content``, ``users.comments``, and
``users.profiles``:

.. code-block:: javascript

Expand Down Expand Up @@ -60,7 +61,8 @@ wildcard specifier (``$**``) to index all fields that contain string
content.

The following example indexes any string value in the data of every
field of every document in a collection and names it ``TextIndex``:
field of every document in ``collection`` and names the index
``TextIndex``:

.. code-block:: javascript

Expand Down Expand Up @@ -104,10 +106,10 @@ Control Results of Text Search with Weights

By default, the :dbcommand:`text` command returns matching documents
based on scores, from highest to lowest. For a ``text`` index, the
*weight* of an indexed field denote the significance of the field
*weight* of an indexed field denotes the significance of the field
relative to the other indexed fields in terms of the score. The score
calculation for a given word in a document includes the weighted sum of
the frequency for each of the indexed fields in that document.
for a given word in a document is derived from the weighted sum of the
frequency for each of the indexed fields in that document.

The default weight is 1 for the indexed fields. To adjust the weights
for the indexed fields, include the ``weights`` option in the
Expand Down Expand Up @@ -135,7 +137,9 @@ A collection ``blog`` has the following documents:

To create a ``text`` index with different field weights for the
``content`` field and the ``keywords`` field, include the ``weights``
option to the :method:`~db.collection.ensureIndex()` method.
option to the :method:`~db.collection.ensureIndex()` method. For
example, the following command creates an index on three fields and
assigns weights to two of the fields:

.. code-block:: javascript

Expand Down
2 changes: 1 addition & 1 deletion source/includes/fact-text-index-limit-one.rst
Original file line number Diff line number Diff line change
@@ -1 +1 @@
A collection can have at most only **one** ``text`` index.
A collection can have at most **one** ``text`` index.
23 changes: 13 additions & 10 deletions source/reference/command/text.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ text
.. versionadded:: 2.4

The :dbcommand:`text` command provides an interface to search text
context stored in the :ref:`text index <index-feature-text>`. By
content stored in the :ref:`text index <index-feature-text>`. By
default, the command limits the matches to the top 100 scoring
documents, in descending score order, but you can specify a
different limit. The :dbcommand:`text` command is
Expand Down Expand Up @@ -46,7 +46,7 @@ text
- The negated word excludes documents that contain the
negated word from the result set.

- A search string that only contains negative words returns
- A search string that only contains negated words returns
**no** match.

- A hyphenated word, such as ``pre-market``, is not a
Expand Down Expand Up @@ -85,9 +85,10 @@ text

Optional. Specify the language that determines for the search
the list of stop words and the rules for the stemmer and
tokenizer. If not specified, the search uses default language
of the index. See :ref:`text-search-languages` for the
supported languages. Specify the language in **lowercase**.
tokenizer. If not specified, the search uses the default
language of the index. See :ref:`text-search-languages` for
the supported languages. Specify the language in
**lowercase**.

:return:

Expand All @@ -96,8 +97,10 @@ text
order by score. See :ref:`text-search-output` for details.

The returned document must fit within the :limit:`BSON
Document Size`. Use the ``limit`` and the ``project``
parameters to limit the size of the result set.
Document Size`. Otherwise, the command will return as many
results as not to exceed the :limit:`BSON Document Size`.
Use the ``limit`` and the ``project`` parameters to limit
the size of the result set.

.. note::

Expand All @@ -110,10 +113,10 @@ text
logical ``AND`` operator.

- The :dbcommand:`text` command ignores stop words for the search
language language, such as ``the`` and ``and`` in English.
language, such as ``the`` and ``and`` in English.

- The :dbcommand:`text` command matches on the complete *stemmed*
words. So if a document field contains the word ``blueberry``,
word. So if a document field contains the word ``blueberry``,
a search on the term ``blue`` will not match. However,
``blueberry`` or ``blueberries`` will match.

Expand Down Expand Up @@ -157,7 +160,7 @@ text

Use the hyphen (``-``) as a prefix to exclude documents that
contain a term. Search for documents that contain the words
``bake`` or ``coffee``, but does **not** contain ``cake``:
``bake`` or ``coffee`` but do **not** contain ``cake``:

.. code-block:: javascript

Expand Down
7 changes: 4 additions & 3 deletions source/reference/text-search.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ example:
.. warning::

The complete results of the :dbcommand:`text` command must fit
within the :limit:`BSON Document Size`. Use the ``limit`` and the
``project`` parameters with the :dbcommand:`text` command to limit
the size of the result set.
within the :limit:`BSON Document Size`. Otherwise, the command will
return as many results as not to exceed the :limit:`BSON Document
Size`. Use the ``limit`` and the ``project`` parameters with the
:dbcommand:`text` command to limit the size of the result set.

.. code-block:: javascript

Expand Down