Using django-haystack, how do I perform a search with only partial terms?
Posted
by
Sri Raghavan
on Stack Overflow
See other posts from Stack Overflow
or by Sri Raghavan
Published on 2011-01-05T03:08:28Z
Indexed on
2011/01/14
3:53 UTC
Read the original article
Hit count: 333
django
|django-haystack
I've got a Haystack/xapian search index for django.contrib.auth.models.User
. The template is simply
{{object.get_full_name}}
as I intend for a user to type in a name and be able to search for it.
My issue is this: if I search, say, Sri
(my full first name) I come up with a result for the user object pertaining to my name. However, if I search Sri Ragh
- that is, my full name, and part of my last name, I get no results.
How can I set Haystack up so that I can get the appropriate results for partial queries?
(I essentially want it to search *Sri Ragh*
, but I don't know if wildcards would actually do the trick, or how to implement them).
This is my search query:
results = SearchQuerySet().filter(content='Sri Ragh')
© Stack Overflow or respective owner