Domanda

I tried so many things..

# in replica set configuration, specify the name of the replica set
# replSet = setname
setParameter=textSearchEnabled=true

This is the part of config file. Still after setting this the text search is not enabled.

Am using pymongo for text searching This is my code

db.command("text", 'tracks' ,search=request.POST['content_search'], limit = 12)['results']]

My mongo version is 2.4.10. Please guide me.

This is the traceback

Traceback (most recent call last):
  File "/home/nidhin/social-media-widget/env/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 114, in get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/home/nidhin/social-media-widget/env/local/lib/python2.7/site-packages/django/views/decorators/csrf.py", line 57, in wrapped_view
    return view_func(*args, **kwargs)
  File "/home/nidhin/social-media-widget/socialmedia/widget/views.py", line 84, in monitor
    data = [i['obj'] for i in db.command("text", 'tracks' ,search=request.POST['content_search'], filter = test_data, limit = 12)['results']]
  File "/home/nidhin/social-media-widget/env/local/lib/python2.7/site-packages/pymongo/database.py", line 435, in command
    uuid_subtype, compile_re, **kwargs)[0]
  File "/home/nidhin/social-media-widget/env/local/lib/python2.7/site-packages/pymongo/database.py", line 341, in _command
    msg, allowable_errors)
  File "/home/nidhin/social-media-widget/env/local/lib/python2.7/site-packages/pymongo/helpers.py", line 178, in _check_command_response
    raise OperationFailure(msg % errmsg, code, response)
OperationFailure: command SON([('text', 'tracks'), ('filter', {'publisher_desc': u'Blogs'}), ('search', u'box'), ('limit', 12)]) failed: text search not enabled
È stato utile?

Soluzione

Adding this line to config file should work:

setParameter=textSearchEnabled=true

How do you start mongdb?

Edit: I recommend you to check that:

  • You have mongodb started with this config. You could check it by calling db.runCommand("getCmdLineOpts") in MongoDb shell
  • via MongoDb Shell db.runCommand({getParameter:1, textSearchEnabled: 1}) returns textSearchEnabled:true
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top