You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Muralidharan V <mu...@gmail.com> on 2008/12/05 00:02:41 UTC
Suggestions for drill downs
We are evaluating lucene for a product search engine. One requirement is
that we be able to suggest the top n brands(the ones with most products in
the result set) for a given search term to further refine the search query.
The brand is stored in a separate field and searches are performed against
product description and brand.
One option is to use a custom HitCollector to keep track of the brands in
the result set but that would require reading the brand field for each doc
that matches the search term. We think this will be an order of magnitude
slower. Is there anything else that we can do?
Thanks,
Murali
Re: Suggestions for drill downs
Posted by Jason Rutherglen <ja...@gmail.com>.
The field cache is completely reloaded. LUCENE-831 solves this by merging
the field caches of the segments. For realtime search systems, merging the
field caches is not desirable though.
On Thu, Dec 4, 2008 at 6:45 PM, John Wang <jo...@gmail.com> wrote:
> Glad to be of help.
> Understand that FieldCache lives in a map in the static memory and is keyed
> by an IndexReader. So if your reader updates often there might be an issue
> of cleaning the map.
>
> This is a question for the Luceners, when you call IndexReader.reopen, how
> is FieldCache updated?
>
> -John
>
> On Thu, Dec 4, 2008 at 5:46 PM, Muralidharan V <muralidharan@gmail.com
> >wrote:
>
> > John,
> >
> > Using the FieldCache worked well. Thanks!
> >
> > -Murali
> >
> > On Thu, Dec 4, 2008 at 3:10 PM, John Wang <jo...@gmail.com> wrote:
> >
> > > Easiest way to do this is using the FieldCache. It constructs a
> > StringIndex
> > > object which gives you very fast lookup to the field value (index)
> given
> > a
> > > docid. Create a parallel count array to the lookup array for the
> > > StringIndex. Run your HitCollector thru should be fast.
> > > Loading FieldCache maybe expensive, but you do it only once when
> opening
> > > the
> > > reader.
> > >
> > > This is one way of implementing Faceted Search with Lucene but there
> are
> > > lotsa things you can do to make this faster.
> > >
> > > This is of course assuming your Brand field is indexed and not
> tokenized.
> > >
> > > One side-benefit is that if you do this, sorting on Brand would be fast
> > > because FieldCache would be already loaded.
> > >
> > > Hope this helps
> > >
> > > -John
> > >
> > >
> > > On Thu, Dec 4, 2008 at 3:02 PM, Muralidharan V <muralidharan@gmail.com
> > > >wrote:
> > >
> > > > We are evaluating lucene for a product search engine. One requirement
> > is
> > > > that we be able to suggest the top n brands(the ones with most
> products
> > > in
> > > > the result set) for a given search term to further refine the search
> > > query.
> > > > The brand is stored in a separate field and searches are performed
> > > against
> > > > product description and brand.
> > > >
> > > > One option is to use a custom HitCollector to keep track of the
> brands
> > in
> > > > the result set but that would require reading the brand field for
> each
> > > doc
> > > > that matches the search term. We think this will be an order of
> > magnitude
> > > > slower. Is there anything else that we can do?
> > > >
> > > > Thanks,
> > > > Murali
> > > >
> > >
> >
>
Re: Suggestions for drill downs
Posted by John Wang <jo...@gmail.com>.
Glad to be of help.
Understand that FieldCache lives in a map in the static memory and is keyed
by an IndexReader. So if your reader updates often there might be an issue
of cleaning the map.
This is a question for the Luceners, when you call IndexReader.reopen, how
is FieldCache updated?
-John
On Thu, Dec 4, 2008 at 5:46 PM, Muralidharan V <mu...@gmail.com>wrote:
> John,
>
> Using the FieldCache worked well. Thanks!
>
> -Murali
>
> On Thu, Dec 4, 2008 at 3:10 PM, John Wang <jo...@gmail.com> wrote:
>
> > Easiest way to do this is using the FieldCache. It constructs a
> StringIndex
> > object which gives you very fast lookup to the field value (index) given
> a
> > docid. Create a parallel count array to the lookup array for the
> > StringIndex. Run your HitCollector thru should be fast.
> > Loading FieldCache maybe expensive, but you do it only once when opening
> > the
> > reader.
> >
> > This is one way of implementing Faceted Search with Lucene but there are
> > lotsa things you can do to make this faster.
> >
> > This is of course assuming your Brand field is indexed and not tokenized.
> >
> > One side-benefit is that if you do this, sorting on Brand would be fast
> > because FieldCache would be already loaded.
> >
> > Hope this helps
> >
> > -John
> >
> >
> > On Thu, Dec 4, 2008 at 3:02 PM, Muralidharan V <muralidharan@gmail.com
> > >wrote:
> >
> > > We are evaluating lucene for a product search engine. One requirement
> is
> > > that we be able to suggest the top n brands(the ones with most products
> > in
> > > the result set) for a given search term to further refine the search
> > query.
> > > The brand is stored in a separate field and searches are performed
> > against
> > > product description and brand.
> > >
> > > One option is to use a custom HitCollector to keep track of the brands
> in
> > > the result set but that would require reading the brand field for each
> > doc
> > > that matches the search term. We think this will be an order of
> magnitude
> > > slower. Is there anything else that we can do?
> > >
> > > Thanks,
> > > Murali
> > >
> >
>
Re: Suggestions for drill downs
Posted by Muralidharan V <mu...@gmail.com>.
John,
Using the FieldCache worked well. Thanks!
-Murali
On Thu, Dec 4, 2008 at 3:10 PM, John Wang <jo...@gmail.com> wrote:
> Easiest way to do this is using the FieldCache. It constructs a StringIndex
> object which gives you very fast lookup to the field value (index) given a
> docid. Create a parallel count array to the lookup array for the
> StringIndex. Run your HitCollector thru should be fast.
> Loading FieldCache maybe expensive, but you do it only once when opening
> the
> reader.
>
> This is one way of implementing Faceted Search with Lucene but there are
> lotsa things you can do to make this faster.
>
> This is of course assuming your Brand field is indexed and not tokenized.
>
> One side-benefit is that if you do this, sorting on Brand would be fast
> because FieldCache would be already loaded.
>
> Hope this helps
>
> -John
>
>
> On Thu, Dec 4, 2008 at 3:02 PM, Muralidharan V <muralidharan@gmail.com
> >wrote:
>
> > We are evaluating lucene for a product search engine. One requirement is
> > that we be able to suggest the top n brands(the ones with most products
> in
> > the result set) for a given search term to further refine the search
> query.
> > The brand is stored in a separate field and searches are performed
> against
> > product description and brand.
> >
> > One option is to use a custom HitCollector to keep track of the brands in
> > the result set but that would require reading the brand field for each
> doc
> > that matches the search term. We think this will be an order of magnitude
> > slower. Is there anything else that we can do?
> >
> > Thanks,
> > Murali
> >
>
Re: Suggestions for drill downs
Posted by John Wang <jo...@gmail.com>.
Easiest way to do this is using the FieldCache. It constructs a StringIndex
object which gives you very fast lookup to the field value (index) given a
docid. Create a parallel count array to the lookup array for the
StringIndex. Run your HitCollector thru should be fast.
Loading FieldCache maybe expensive, but you do it only once when opening the
reader.
This is one way of implementing Faceted Search with Lucene but there are
lotsa things you can do to make this faster.
This is of course assuming your Brand field is indexed and not tokenized.
One side-benefit is that if you do this, sorting on Brand would be fast
because FieldCache would be already loaded.
Hope this helps
-John
On Thu, Dec 4, 2008 at 3:02 PM, Muralidharan V <mu...@gmail.com>wrote:
> We are evaluating lucene for a product search engine. One requirement is
> that we be able to suggest the top n brands(the ones with most products in
> the result set) for a given search term to further refine the search query.
> The brand is stored in a separate field and searches are performed against
> product description and brand.
>
> One option is to use a custom HitCollector to keep track of the brands in
> the result set but that would require reading the brand field for each doc
> that matches the search term. We think this will be an order of magnitude
> slower. Is there anything else that we can do?
>
> Thanks,
> Murali
>