You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Julian Davchev <jm...@drun.net> on 2009/06/22 17:48:50 UTC

spellcheck. limit the suggested words by some field

Hi,
I have build spellcheck dictionary based on name field.
It works like a charm but I'd like to limit the returned suggestion.
For example we have following sturcutre

id      name       type
1        Berlin      city
2        bergan    phony


So when I search for  suggested words of "ber" I would get both Berlin
and bergan      but I somehow want to limit to only those of type city.
I tried with fq=type:city             but this didn't help either.

Any pointers are more than welcome.  The other approeach would be makind
different spellcheck dictionaries based on type and just use the
specific dictionary but then again....I didn't see option howto build
dictionary based on type.

Thanks.

Re: spellcheck. limit the suggested words by some field

Posted by Julian Davchev <jm...@drun.net>.
I seem to have found answer to this one by digging 30mins in archives.
One approach is to use copyfield and store only stuff that is
interesting  e.g     spell_city field that will have stuff only where
type is city

Second approach includes extending IndexBasedSpellchecker ..alas  I can
find nowhere in  docs how is this done.



Julian Davchev wrote:
> Hi,
> I have build spellcheck dictionary based on name field.
> It works like a charm but I'd like to limit the returned suggestion.
> For example we have following sturcutre
>
> id      name       type
> 1        Berlin      city
> 2        bergan    phony
>
>
> So when I search for  suggested words of "ber" I would get both Berlin
> and bergan      but I somehow want to limit to only those of type city.
> I tried with fq=type:city             but this didn't help either.
>
> Any pointers are more than welcome.  The other approeach would be makind
> different spellcheck dictionaries based on type and just use the
> specific dictionary but then again....I didn't see option howto build
> dictionary based on type.
>
> Thanks.
>