Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-380

basic text indexing and search

    • Type: Icon: New Feature New Feature
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.3.2
    • Affects Version/s: None
    • Component/s: Index Maintenance, Querying
    • Labels:
      None
    • Fully Compatible

      Simple text indexing.
      Initial version will be marked as experimental, so has to be turned on with a command line flag or at runtime.

      db.adminCommand( { setParameter : "*", textSearchEnabled : true } );
      

      OR

      ./mongod --setParameter textSearchEnabled=true
      

      Only works via "text" command currently.

      Features:

      • parsing + stemming for latin languages
      • multi-word scoring
      • phrase matching
      • word negation
      • weights per field
      • additional suffix index fields for coverings
      • additional prefix index fields for partitioning
      • specify language per document

      Simple Example:

      > db.foo.insert( { _id: 1 , desc: "the dog is running" } )
      > db.foo.insert( { _id: 2 , desc: "the cat is walking" } )
      > db.foo.ensureIndex( { "desc": "text" } )
      > db.foo.runCommand( "text", { search : "walk" } )
      {
      	"queryDebugString" : "walk||||||",
      	"language" : "english",
      	"results" : [
      		{
      			"score" : 0.75,
      			"obj" : {
      				"_id" : 2,
      				"desc" : "the cat is walking"
      			}
      		}
      	],
      	"stats" : {
      		"nscanned" : 1,
      		"nscannedObjects" : 0,
      		"n" : 1,
      		"timeMicros" : 330
      	},
      	"ok" : 1
      }