Skip to content

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 1 commit into from
Feb 22, 2013
Merged
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
99 changes: 96 additions & 3 deletions source/release-notes/2.4.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Copy link
Contributor

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?

Copy link
Contributor Author

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.


Text Queries
^^^^^^^^^^^^

Expand Down Expand Up @@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The 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:

Expand Down Expand Up @@ -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
Expand Down