"obj" : { "_id" : ObjectId( ... ) "loc" : [ -73, 40 ] } } ], "stats" : { // [ ... ] "avgDistance" : 0.01853688938212826, "maxDistance" : 0.01853714811400047 }, "ok" : 1 } 

## 8.3.4 Text Search Tutorials 

Instructions for enabling MongoDB’s text search feature, and for building and configuring text indexes. 

Create a text Index (page 539) A text index allows searches on text strings in the index’s specified fields. 

Specify a Language for Text Index (page 540) The specified language determines the list of stop words and the rules for Text Search’s stemmer and tokenizer. 

Specify Name for text Index (page 542) Override the text index name limit for long index names. 

Control Search Results with Weights (page 543) Give priority to certain search values by denoting the significance of an indexed field relative to other indexed fields 

Limit the Number of Entries Scanned (page 544) Create an index to support queries that includes $text expres- sions and equality conditions. 

Text Search in the Aggregation Pipeline (page 545) Perform various text search in the aggregation pipeline. 

## Create a text Index 

You can create a text index on the field or fields whose value is a string or an array of string elements. When creating a text index on multiple fields, you can specify the individual fields or you can use wildcard specifier ( $ $_{**}$). 

## Index Specific Fields 

The following example creates a text index on the fields subject and content : 

db.collection.createIndex( { subject: "text", content: "text" } ) 

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. 

