-
Notifications
You must be signed in to change notification settings - Fork 1.7k
DOCS-1046 add default_language and language_override options for text in... #674
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -299,6 +299,59 @@ likely to appear in responses than words from other fields. | |
when creating the index, you can find the name using | ||
:method:`db.collection.getIndexes()` | ||
|
||
.. _text-index-specify-language: | ||
|
||
Specify Languages for Text Index | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
The default language associated with the indexed data determines the | ||
list of stop words and the rules for the stemmer and tokenizer. The | ||
default language for the indexed data is ``english``. | ||
|
||
Use the ``default_language`` option when creating the ``text`` index to | ||
specify a different language. See :ref:`text-search-languages`. | ||
|
||
The following example creates a ``text`` index on the | ||
``content`` field and sets the ``default_language`` to | ||
``spanish``: | ||
|
||
.. code-block:: javascript | ||
|
||
db.collection.ensureIndex( { content : "text" }, | ||
{ default_language: "spanish" } ) | ||
|
||
If a collection contains documents that are in different languages, the | ||
individual documents can specify the language to use. | ||
|
||
- By default, if the documents in the collection contain a field named | ||
``language``, the value of the ``language`` field overrides the | ||
default language. | ||
|
||
For example, the following document overrides the default language | ||
``spanish`` with ``portuguese``, the value in its ``language`` field. | ||
|
||
.. code-block:: javascript | ||
|
||
{ content: "A sorte protege os audazes", language: "portuguese" } | ||
|
||
- To use a different field to override the default language, specify the | ||
field with the ``language_override`` option when creating the index. | ||
|
||
For example, if the documents contain the field named ``myLanguage`` | ||
instead of ``language``, create the ``text`` index with the | ||
``language_override`` option. | ||
|
||
.. code-block:: javascript | ||
|
||
db.collection.ensureIndex( { content : "text" }, | ||
{ language_override: "myLanguage" } ) | ||
|
||
.. .. note:: | ||
.. If you specify a ``default_language`` of ``"none"``, or the override | ||
language is ``"none"``, the :dbcommand:`text` command will not stem | ||
the words. The command will also consider all words, i.e., it will not | ||
drop the stop words. | ||
|
||
Text Queries | ||
^^^^^^^^^^^^ | ||
|
||
|
@@ -363,9 +416,11 @@ cursor. | |
|
||
:param string language: | ||
|
||
Optional. Specify the language that determines the tokenization, | ||
stemming, and the stop words for the search. The default language | ||
is ``english``. | ||
Optional. Specify, for the search, the language that determines | ||
the list of stop words and the rules for the stemmer and | ||
tokenizer. The default language is the value of the | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. see above comment... |
||
``default_language`` field specified during the index creation. | ||
See :ref:`text-search-languages` for the supported languages. | ||
|
||
:return: | ||
|
||
|
@@ -477,6 +532,44 @@ cursor. | |
document, you cannot mix inclusions (i.e. ``<fieldA>: 1``) and | ||
exclusions (i.e. ``<fieldB>: 0``), except for the ``_id`` field. | ||
|
||
.. _text-search-languages: | ||
|
||
Languages Supported in Text Search | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
The ``text`` index and the :dbcommand:`text` command support the | ||
following languages: | ||
|
||
- ``danish`` | ||
|
||
- ``dutch`` | ||
|
||
- ``english`` | ||
|
||
- ``finnish`` | ||
|
||
- ``french`` | ||
|
||
- ``german`` | ||
|
||
- ``hungarian`` | ||
|
||
- ``italian`` | ||
|
||
- ``norwegian`` | ||
|
||
- ``portuguese`` | ||
|
||
- ``romanian`` | ||
|
||
- ``russian`` | ||
|
||
- ``spanish`` | ||
|
||
- ``swedish`` | ||
|
||
- ``turkish`` | ||
|
||
.. _kerberos-authentication: | ||
|
||
New Modular Authentication System with Support for Kerberos | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this a comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had a comment, in the old document I had, that stated the "Not sure if we want to document this none functionality". So, given the confusing jumble of phrases, I figured for the release notes to remove it.