Mailing List Archive

Auto-complete in Lucene
Hi All,

I have a question regarding auto-complete functionality in Lucene.
On the StackOverflow the suggestion regarding implementation is
1) Use AnalyzingSuggester
2) Use PrefixQuery and SpanFirstQuery with the IndexSearcher.search()

What is the differences between them? Do they have big differences in
performance?

Currently for suggest we are using SuggestIndexSearcher.suggest() method,
but there is no availability to add scoring by some field (what exactly we
need) and I did not found any recommendation on the StackOverflow for this
method.

And now the question is what is the better to use 1# or 2# for
auto-complete.
Could you advice?

Thank you
Re: Auto-complete in Lucene [ In reply to ]
we are using? AnalyzingInfixSuggester but I would also be curious to
know whether this is the best way :-)

Thanks

Michael

Am 25.05.22 um 14:39 schrieb Anastasiya Tarasenko:
> Hi All,
>
> I have a question regarding auto-complete functionality in Lucene.
> On the StackOverflow the suggestion regarding implementation is
> 1) Use AnalyzingSuggester
> 2) Use PrefixQuery and SpanFirstQuery with the IndexSearcher.search()
>
> What is the differences between them? Do they have big differences in
> performance?
>
> Currently for suggest we are using SuggestIndexSearcher.suggest() method,
> but there is no availability to add scoring by some field (what exactly we
> need) and I did not found any recommendation on the StackOverflow for this
> method.
>
> And now the question is what is the better to use 1# or 2# for
> auto-complete.
> Could you advice?
>
> Thank you
>
Re: Auto-complete in Lucene [ In reply to ]
Thank you for comment)

For our task it seems a redundant, because per my understanding
AnalyzingInfixSuggester find matches anywhere from query string, for our
purpose we need only prefix search.
For AnalyzingSuggester it scares me that when new entry is coming or
changed you have to rebuild the suggest index every time.

On Wed, May 25, 2022 at 4:16 PM Michael Wechner <michael.wechner@wyona.com>
wrote:

> we are using AnalyzingInfixSuggester but I would also be curious to
> know whether this is the best way :-)
>
> Thanks
>
> Michael
>
> Am 25.05.22 um 14:39 schrieb Anastasiya Tarasenko:
> > Hi All,
> >
> > I have a question regarding auto-complete functionality in Lucene.
> > On the StackOverflow the suggestion regarding implementation is
> > 1) Use AnalyzingSuggester
> > 2) Use PrefixQuery and SpanFirstQuery with the IndexSearcher.search()
> >
> > What is the differences between them? Do they have big differences in
> > performance?
> >
> > Currently for suggest we are using SuggestIndexSearcher.suggest() method,
> > but there is no availability to add scoring by some field (what exactly
> we
> > need) and I did not found any recommendation on the StackOverflow for
> this
> > method.
> >
> > And now the question is what is the better to use 1# or 2# for
> > auto-complete.
> > Could you advice?
> >
> > Thank you
> >
>
Re: Auto-complete in Lucene [ In reply to ]
Hi Anastasiya,

> 1) Use AnalyzingSuggester
> 2) Use PrefixQuery and SpanFirstQuery with the IndexSearcher.search()
> What is the differences between them? Do they have big differences in
> performance?

I don't think they are directly comparable but internally,
AnalyzingSuggerster decompounds the tokens into (edge) ngrams, indexes
those ngrams, then looks up matching entries by TermQuery at query time.
I would recommend following the AnalyzingSuggester's source code if you
have a bit of experience with Lucene API, so that you have a concrete image
of it?
It does not play with too low-level APIs, and I think it can be seen as a
very interesting search application of Lucene :)

Tomoko


2022?5?26?(?) 1:34 Anastasiya Tarasenko <anastasiyatarasenko24@gmail.com>:

> Thank you for comment)
>
> For our task it seems a redundant, because per my understanding
> AnalyzingInfixSuggester find matches anywhere from query string, for our
> purpose we need only prefix search.
> For AnalyzingSuggester it scares me that when new entry is coming or
> changed you have to rebuild the suggest index every time.
>
> On Wed, May 25, 2022 at 4:16 PM Michael Wechner <michael.wechner@wyona.com
> >
> wrote:
>
> > we are using AnalyzingInfixSuggester but I would also be curious to
> > know whether this is the best way :-)
> >
> > Thanks
> >
> > Michael
> >
> > Am 25.05.22 um 14:39 schrieb Anastasiya Tarasenko:
> > > Hi All,
> > >
> > > I have a question regarding auto-complete functionality in Lucene.
> > > On the StackOverflow the suggestion regarding implementation is
> > > 1) Use AnalyzingSuggester
> > > 2) Use PrefixQuery and SpanFirstQuery with the IndexSearcher.search()
> > >
> > > What is the differences between them? Do they have big differences in
> > > performance?
> > >
> > > Currently for suggest we are using SuggestIndexSearcher.suggest()
> method,
> > > but there is no availability to add scoring by some field (what exactly
> > we
> > > need) and I did not found any recommendation on the StackOverflow for
> > this
> > > method.
> > >
> > > And now the question is what is the better to use 1# or 2# for
> > > auto-complete.
> > > Could you advice?
> > >
> > > Thank you
> > >
> >
>