Skip to content


whoosh search index fails to build #4309

Mrten opened this Issue · 7 comments

4 participants


I've not gotten salt-run search.query to work unless I add a call to index() in's query().

---    2013-03-19 05:58:34.000000000 +0100
+++    2013-03-28 20:15:14.576812307 +0100
@@ -79,6 +79,7 @@
     if whoosh.index.exists_in(index_dir):
         ix_ = whoosh.index.open_dir(index_dir)
+        index()
         return {}
     qp_ = whoosh.qparser.QueryParser(u'content', schema=ix_.schema)
     qobj = qp_.parse(unicode(qstr), limit)

I'm quite sure it is not the way to go , but this is how I got it to not return {} to my queries.

Salt Stack member

Thanks, I will add it for now until we can spend more time on the search indexing


However, if I do this, this is the answer:

root@salt-master:/usr/share/pyshared/salt/search# salt-run search.query \.
Traceback (most recent call last):
  File "/usr/bin/salt-run", line 10, in <module>
  File "/usr/lib/pymodules/python2.7/salt/", line 89, in salt_run
  File "/usr/lib/pymodules/python2.7/salt/cli/", line 273, in run
  File "/usr/lib/pymodules/python2.7/salt/", line 85, in run
    self.opts['fun'], self.opts['arg'], self.opts)
  File "/usr/lib/pymodules/python2.7/salt/", line 51, in cmd
    return self.functions[fun](*arg)
  File "/usr/lib/pymodules/python2.7/salt/runners/", line 15, in query
    result = search.query(term)
  File "/usr/lib/pymodules/python2.7/salt/search/", line 109, in query
  File "/usr/lib/pymodules/python2.7/salt/search/", line 85, in query
  File "/usr/lib/pymodules/python2.7/salt/search/", line 60, in index
    writer.add_document(fn_type=u'file', **chunk)
TypeError: add_document() argument after ** must be a mapping, not generator

You're too fast! :smiley:

Salt Stack member

Thanks, this is good info to get this going.

Salt Stack member

I am glad you think so, because I probably won't be able to get to this code for perhaps a week +


np, happy to help!

@basepi basepi modified the milestone: Approved, Outstanding Bugs

This is a pretty old issue but appears fixed in develop. Here's what I did to reproduce:

1) Add search: whoosh to master config
2) Restart master
3) salt-run search.query \.

Returned 'None'.

No traceback seen as was reported above. I'm not terribly familiar with the whoosh search interface so if I'm missing something, feel free to let me know and I'll re-open this. For the time being, however, I'm going to go ahead and close this.

@cachedout cachedout closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.