What works very good for me:

1.) Keep the tokenized field (KeywordTokenizerFilter,
WordDelimiterFilter) (like you described you had)
2.) create an additional field that stores uses the String type with the
same content (use copy field to fill either)
3.) use facet.prefix instead of terms.prefix for searching the
suggestions
4.) to your query add also the String field as a facet, and return the
results from that field as suggestion list. They will include the
complete String "canon pixma mp500" for example. The other field can
only return facets based on tokens. You probably never want that as
facets.

So your query was alright and the "canon" (2) facet count probably is
the two occurrences that you listed, but as the field was tokenized,
only tokens would be returned as facets. You need to have an additional
field of pure String type to get the complete value as a facet back.

In general, it worked out fine for me to create String fields as return
values for facets while using the tokenized fields for searching and the
actual facet queries.

Cheers,
Chantal


On Wed, 2010-09-22 at 16:39 +0200, Jason Rutherglen wrote:
> This may be what you're looking for.
> http://www.lucidimagination.com/blog/2009/09/08/auto-suggest-from-popular-queries-using-edgengrams/
> 
> On Wed, Sep 22, 2010 at 4:41 AM, Arunkumar Ayyavu
> <[email protected]> wrote:
> > It's been over a week since I started learning Solr. Now, I'm using the
> > electronics store example to explore the autocomplete feature in Solr.
> >
> > When I send the query terms.fl=name&terms.prefix=canon to terms request
> > handler, I get the following response
> > <lst name="terms">
> >  <lst name="name">
> >   <int name="canon">2</int>
> >  </lst>
> > </lst>
> >
> > But I expect the following results in the response.
> > canon pixma mp500 all-in-one photo printer
> > canon powershot sd500
> >
> > So, I changed the schema for textgen fieldType to use
> > KeywordTokenizerFactory and also removed WordDelimiterFilterFactory. That
> > gives me the expected result.
> >
> > Now, I also want the Solr to return "canon pixma mp500 all-in-one photo
> > printer"  when I send the query terms.fl=name&terms.prefix=pixma. Could you
> > gurus help me get the expected result?
> >
> > BTW, I couldn't quite understand the behavior of terms.lower and terms.upper
> > (I tried these with the electronics store example). Could you also help me
> > understand these 2 query fields?
> > Thanks.
> >
> > --
> > Arun
> >


Reply via email to