HI
I have installed Massimo's Haystack for Whoosh (
https://github.com/mdipierro/web2py-haystack) and it works and passes the
tests that are included there.
Now I am trying to use it for the tables in the in-built wiki.
However, it doesn't find the search string in the wiki body fields. Has
anyone used whoosh for the in-built wiki?
IN db.py
# Make sure this is called after the auth instance is created
auth.wiki(resolve=False)
IN default.py
def wiki():
return auth.wiki()
# whoosh_haystack.py is a module that contains the code
in plugin_haystack.py (for some reason the plugin doesn't install as a
plugin. works as a module tho)
from whoosh_haystack import *
def search():
index =
Haystack(db.wiki_page,backend=WhooshBackend,indexdir='wiki-whoosh')
index.indexes('title','body')
answers=[]
a='none'
form = SQLFORM.factory(
Field('search', 'string'))
if form.process(keepvalues=True).accepted:
a = form.vars.search
answers=db(index.search(body=a)).select()
return dict(form=form,answers=answers)
IN default/search.html :
{{extend 'layout.html'}}
{{=form}}
{{=answers}}
thanks.
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.