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 Eric Wilson <wi...@gmail.com> on 2013/03/13 16:07:23 UTC

Using suggester for smarter phrase autocomplete

I'm trying to use the suggester for auto-completion with Solr 4. I have
followed the example configuration for phrase suggestions at the bottom of
this wiki page:
http://wiki.apache.org/solr/Suggester<https://mail.manta.com/owa/redir.aspx?C=a570b5bb74f64f4fb810ba260e304ec5&URL=http%3a%2f%2fwiki.apache.org%2fsolr%2fSuggester>

This shows how to use a text file with the following text for phrase
suggestions:

# simple auto-suggest phrase dictionary for testing
# note this uses tabs as separator!
the first phrase	1.0
the second phrase	2.0
testing 1234	3.0
foo	5.0
the fifth phrase	2.0
the final phrase	4.0

This seems to be working in the expected way. If I query for "the f" I
receive the following suggestions:

 <str>the final phrase</str>
 <str>the fifth phrase</str>
 <str>the first phrase</str>

I would like to deal with the case where the user is interested in "the
foo". When "the fo" is entered, there will be no suggestions. Is it
possible to provide both the phrase matches, and the matches for individual
words, so that when the user entered text is no longer part of any actual
phrase, there are still suggestions to be made for the final word?

Thanks,

Eric Wilson

Re: Using suggester for smarter phrase autocomplete

Posted by Jorge Luis Betancourt Gonzalez <jl...@uci.cu>.
Currently I'm using a separated core to query suggestions, for this I've started from: https://github.com/cominvent/autocomplete. Basically the suggester component I'm only using it for term suggestions based on the a tokenized field in my schema (all of this in solr 3.6), perhaps instead of using the suggester component could you use a more similar approach (more like the one on the github repo).

----- Mensaje original -----
De: "Eric Wilson" <wi...@gmail.com>
Para: solr-user@lucene.apache.org
Enviados: MiƩrcoles, 13 de Marzo 2013 13:11:05
Asunto: Re: Using suggester for smarter phrase autocomplete

I'm not concerned about stopwords, rather the situation where the first and
second words are rarely used together, so don't occur together in a phrase
in the dictionary. Thanks.

On Wed, Mar 13, 2013 at 11:11 AM, Robert Muir <rc...@gmail.com> wrote:

> On Wed, Mar 13, 2013 at 11:07 AM, Eric Wilson <wi...@gmail.com>
> wrote:
> > I'm trying to use the suggester for auto-completion with Solr 4. I have
> > followed the example configuration for phrase suggestions at the bottom
> of
> > this wiki page:
> > http://wiki.apache.org/solr/Suggester<
> https://mail.manta.com/owa/redir.aspx?C=a570b5bb74f64f4fb810ba260e304ec5&URL=http%3a%2f%2fwiki.apache.org%2fsolr%2fSuggester
> >
> >
> > This shows how to use a text file with the following text for phrase
> > suggestions:
> >
> > # simple auto-suggest phrase dictionary for testing
> > # note this uses tabs as separator!
> > the first phrase        1.0
> > the second phrase       2.0
> > testing 1234    3.0
> > foo     5.0
> > the fifth phrase        2.0
> > the final phrase        4.0
> >
> > This seems to be working in the expected way. If I query for "the f" I
> > receive the following suggestions:
> >
> >  <str>the final phrase</str>
> >  <str>the fifth phrase</str>
> >  <str>the first phrase</str>
> >
> > I would like to deal with the case where the user is interested in "the
> > foo". When "the fo" is entered, there will be no suggestions. Is it
> > possible to provide both the phrase matches, and the matches for
> individual
> > words, so that when the user entered text is no longer part of any actual
> > phrase, there are still suggestions to be made for the final word?
> >
>
> Is it really the case that you want matches for individual words, or
> just to handle e.g. the stopwords case like 'the fo' -> foo ?
>
> the latter can be done with analyzingsuggester (configure a stopfilter
> on the analyzer).
>

Re: Using suggester for smarter phrase autocomplete

Posted by Eric Wilson <wi...@gmail.com>.
I'm not concerned about stopwords, rather the situation where the first and
second words are rarely used together, so don't occur together in a phrase
in the dictionary. Thanks.

On Wed, Mar 13, 2013 at 11:11 AM, Robert Muir <rc...@gmail.com> wrote:

> On Wed, Mar 13, 2013 at 11:07 AM, Eric Wilson <wi...@gmail.com>
> wrote:
> > I'm trying to use the suggester for auto-completion with Solr 4. I have
> > followed the example configuration for phrase suggestions at the bottom
> of
> > this wiki page:
> > http://wiki.apache.org/solr/Suggester<
> https://mail.manta.com/owa/redir.aspx?C=a570b5bb74f64f4fb810ba260e304ec5&URL=http%3a%2f%2fwiki.apache.org%2fsolr%2fSuggester
> >
> >
> > This shows how to use a text file with the following text for phrase
> > suggestions:
> >
> > # simple auto-suggest phrase dictionary for testing
> > # note this uses tabs as separator!
> > the first phrase        1.0
> > the second phrase       2.0
> > testing 1234    3.0
> > foo     5.0
> > the fifth phrase        2.0
> > the final phrase        4.0
> >
> > This seems to be working in the expected way. If I query for "the f" I
> > receive the following suggestions:
> >
> >  <str>the final phrase</str>
> >  <str>the fifth phrase</str>
> >  <str>the first phrase</str>
> >
> > I would like to deal with the case where the user is interested in "the
> > foo". When "the fo" is entered, there will be no suggestions. Is it
> > possible to provide both the phrase matches, and the matches for
> individual
> > words, so that when the user entered text is no longer part of any actual
> > phrase, there are still suggestions to be made for the final word?
> >
>
> Is it really the case that you want matches for individual words, or
> just to handle e.g. the stopwords case like 'the fo' -> foo ?
>
> the latter can be done with analyzingsuggester (configure a stopfilter
> on the analyzer).
>

Re: Using suggester for smarter phrase autocomplete

Posted by Robert Muir <rc...@gmail.com>.
On Wed, Mar 13, 2013 at 11:07 AM, Eric Wilson <wi...@gmail.com> wrote:
> I'm trying to use the suggester for auto-completion with Solr 4. I have
> followed the example configuration for phrase suggestions at the bottom of
> this wiki page:
> http://wiki.apache.org/solr/Suggester<https://mail.manta.com/owa/redir.aspx?C=a570b5bb74f64f4fb810ba260e304ec5&URL=http%3a%2f%2fwiki.apache.org%2fsolr%2fSuggester>
>
> This shows how to use a text file with the following text for phrase
> suggestions:
>
> # simple auto-suggest phrase dictionary for testing
> # note this uses tabs as separator!
> the first phrase        1.0
> the second phrase       2.0
> testing 1234    3.0
> foo     5.0
> the fifth phrase        2.0
> the final phrase        4.0
>
> This seems to be working in the expected way. If I query for "the f" I
> receive the following suggestions:
>
>  <str>the final phrase</str>
>  <str>the fifth phrase</str>
>  <str>the first phrase</str>
>
> I would like to deal with the case where the user is interested in "the
> foo". When "the fo" is entered, there will be no suggestions. Is it
> possible to provide both the phrase matches, and the matches for individual
> words, so that when the user entered text is no longer part of any actual
> phrase, there are still suggestions to be made for the final word?
>

Is it really the case that you want matches for individual words, or
just to handle e.g. the stopwords case like 'the fo' -> foo ?

the latter can be done with analyzingsuggester (configure a stopfilter
on the analyzer).