How to enable textsearch in mongodb using python?
Question: I have written `textSearchedEnabled=true` in the following script but a syntax
error occurs. I can not understand how to enable the text search in mongo db
using python.

    
    
     import json
     import pymongo # pip install pymongo
     from bson import json_util # Comes with pymongo
     from pymongo import MongoClient
     --setParameter textSearchEnabled=true
     client = pymongo.MongoClient('mongodb://user:user123@ds033499.mongolab.com:33499/enron')
     db = client.enron
     mbox = db.mbox
    
     # Create an index if it doesn't already exist
     mbox.ensure_index([("$**", "text")], name="TextIndex")
    
     # Get the collection stats (collstats) on a collection
     # named "mbox"
     print json.dumps(db.command("collstats", "mbox"), indent=1)
    
     # Use the db.command method to issue a "text" command
     # on collection "mbox" with parameters, remembering that
     # we need to use json_util to handle serialization of our JSON
     print json.dumps(db.command("text", "mbox",  
                            search="raptor", 
                            limit=1), 
                 indent=1, default=json_util.default)
    


Answer: Normally textSearch is enabled via the mongodb.conf or when starting mongodb.
See: [Enable Text Search](http://docs.mongodb.org/manual/tutorial/enable-text-
search/) documentation.

You can also run it via an admin command if the user has the admin rights:

    
    
    client.admin.command('setParameter', textSearchEnabled=True)
    

