Skip to content

Loading…

whoosh search index fails to build #4309

Closed
Mrten opened this Issue · 7 comments

4 participants

@Mrten

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

--- whoosh_search.py    2013-03-19 05:58:34.000000000 +0100
+++ whoosh_search.py.new    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)
     else:
+        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.

@thatch45
Salt Stack member

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

@Mrten

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>
    salt_run()
  File "/usr/lib/pymodules/python2.7/salt/scripts.py", line 89, in salt_run
    client.run()
  File "/usr/lib/pymodules/python2.7/salt/cli/__init__.py", line 273, in run
    runner.run()
  File "/usr/lib/pymodules/python2.7/salt/runner.py", line 85, in run
    self.opts['fun'], self.opts['arg'], self.opts)
  File "/usr/lib/pymodules/python2.7/salt/runner.py", line 51, in cmd
    return self.functions[fun](*arg)
  File "/usr/lib/pymodules/python2.7/salt/runners/search.py", line 15, in query
    result = search.query(term)
  File "/usr/lib/pymodules/python2.7/salt/search/__init__.py", line 109, in query
    return self.search[qfun](term)
  File "/usr/lib/pymodules/python2.7/salt/search/whoosh_search.py", line 85, in query
    index()
  File "/usr/lib/pymodules/python2.7/salt/search/whoosh_search.py", line 60, in index
    writer.add_document(fn_type=u'file', **chunk)
TypeError: add_document() argument after ** must be a mapping, not generator
@Mrten

You're too fast! :smiley:

@thatch45
Salt Stack member

Thanks, this is good info to get this going.

@thatch45
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 +

@Mrten

np, happy to help!

@basepi basepi modified the milestone: Approved, Outstanding Bugs
@cachedout

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.