srini
unread,May 13, 2009, 8:59:54 AM5/13/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to django-haystack
Hi, all
These are the changes we have done in
whoosh_backend.py, and forms.py
In whoosh_backend.py, line 28 we removed "*"
RESERVED_CHARACTERS = (
'\\', '+', '-', '&&', '||', '!', '(', ')', '{', '}',
'[', ']', '^', '"', '~', '?', ':',
)
in forms.py in SearchForm line 31 in search
we added ---------------> qry = "*" + qry + "*"
class SearchForm(forms.Form):
q = forms.CharField(required=False)
def __init__(self, *args, **kwargs):
self.searchqueryset = kwargs.get('searchqueryset', None)
if self.searchqueryset is None:
self.searchqueryset = SearchQuerySet()
try:
del(kwargs['searchqueryset'])
except KeyError:
pass
super(SearchForm, self).__init__(*args, **kwargs)
def search(self):
self.clean()
qry = self.cleaned_data['q']
qry = qry.lower()
qry = "*" + qry + "*"
return self.searchqueryset.auto_query(qry)
Thank you