Spelling Suggestion using more than one model!

155 views
Skip to first unread message

drozzy

unread,
Nov 11, 2009, 6:10:23 PM11/11/09
to django-haystack
Hi, I would like to use spelling suggestion in my search. The problem
is that it is suggesting TOO much.

Consider I have two models:
Apples and Oranges.

If I have somethine like this:
result = SearchQuerySet().models(Apples).filter
(content=escaped_value).spelling_suggestion(escaped_value)

it will actually LOOK into Oranges table and return a spelling
suggestion from that! It seems like models(Apples) restriction does
not work.

I have indexes setup for both models, with "text" attribute as
document=True. My spelling is ON. I am using Whoosh as backend.

Help anyone?

Daniel Lindsley

unread,
Nov 12, 2009, 12:29:46 AM11/12/09
to django-...@googlegroups.com
Drozzy,


Haystack builds spelling suggestions based off your
`document=True` field and doesn't pay attention to the model type when
generating the suggestion. That probably ought to be documented as
such. By using Whoosh itself, it's possible to build alternate
spelling indexes but that'd be pretty custom and very situational.
You'd want to poke at
http://trac.whoosh.ca/browser/projects/whoosh/trunk/src/whoosh/spelling.py#L26

If you wouldn't mind adding an issue about it, I'll try to think on
it further and see if there's a way Haystack could at least help in
this regard.


Daniel
> --
>
> You received this message because you are subscribed to the Google Groups "django-haystack" group.
> To post to this group, send email to django-...@googlegroups.com.
> To unsubscribe from this group, send email to django-haysta...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/django-haystack?hl=.
>
>
>

drozzy

unread,
Nov 12, 2009, 8:14:19 AM11/12/09
to django-haystack
Wow, that is fast response. Refreshing to see a cool project that is
actively supported and developed.

Issue is done here:
http://github.com/toastdriven/django-haystack/issues/#issue/124

I am not very eager to modify Whoosh because I am thinking of
switching back-end later on. My only option for now is to go without
spelling suggestions for subsections of the site. I will only have
suggestions on the Site Wide search form.



On Nov 12, 1:29 am, Daniel Lindsley <polarc...@gmail.com> wrote:
> Drozzy,
>
>     Haystack builds spelling suggestions based off your
> `document=True` field and doesn't pay attention to the model type when
> generating the suggestion. That probably ought to be documented as
> such. By using Whoosh itself, it's possible to build alternate
> spelling indexes but that'd be pretty custom and very situational.
> You'd want to poke athttp://trac.whoosh.ca/browser/projects/whoosh/trunk/src/whoosh/spelli...

Daniel Lindsley

unread,
Nov 12, 2009, 12:15:35 PM11/12/09
to django-...@googlegroups.com
drozzy,


Sadly I've been very slow lately (especially if you look at the
size and the dates on the issues list). I'm working on getting better
and am going to set aside some sprint nights for myself in the next
couple weeks to get that list under control and finally release
Haystack for real.


Daniel
Reply all
Reply to author
Forward
0 new messages