Database Reference
In-Depth Information
MongoDB can index these coordinates by specifying 2dsphere , 2d , or
haystack instead of a number when adding a field to an index. For most
applications, 2dsphere is probably the most appropriate choice for
indexing. However, if the area to be indexed is geospatially small,
haystack indexing can improve query performance.
Full Text Indexing
When an index is created with a field's index type set to text rather than
a number, MongoDB's full text indexing is enabled. This is currently a
beta feature, so this capability must be enabled when starting the server by
adding --setParameter textSearchEnabled=true to the command
line.
In many ways, this type of index is similar to the multikey index used when
the field is an array. The primary difference is that the field is expected to be
a string, which is tokenized and stemmed to form the words entered into the
index. MongoDB also maintains a list of language-specific stop words that
are dropped from the indexing process.
Queries for a set of search terms are computed using a scoring system.
MongoDB maintains scores for different words for each language it
supports, but this may be overridden when creating the index. The optional
parameter is given in a later section.
This form of indexing requires a fair bit of processing power, so it should
be used with caution. Inserting documents into a full text indexed collection
will also incur a processing cost associated with the tokenization and
stemming process, so it is not recommended for high-throughput
collections.
Other Indexing Options
When the index is created it is automatically given a name. This name
can be at most 125 characters when combined with the collection name,
which can be exceeded when building complicated indexes. To avoid this,
or for aesthetic reasons, indexes can be named using the options object
when creating the index. The options object also allows for a variety of other
optional parameters, given in Table 6.1 .
 
Search WWH ::




Custom Search