Skip to content

Instantly share code, notes, and snippets.

@cpatrick
Last active December 18, 2015 03:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cpatrick/5719037 to your computer and use it in GitHub Desktop.
Save cpatrick/5719037 to your computer and use it in GitHub Desktop.
Enabling Mongo full-text search and building an index.
// enable text search
db.adminCommand( { setParameter : 1, textSearchEnabled : true } )
// build canepi-specific indices
db.healthmap.ensureIndex({"properties.summary": "text",
"properties.descr": "text",
"properties.country": "text",
"properties.disease": "text"},
{ weights: { "properties.summary": 10,
"properties.descr": 5,
"properties.disease": 10,
"properties.country":10},
name: "TextIndex"});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment