lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shai Erera <>
Subject Re: Facet counts and drill down queries
Date Sat, 03 Dec 2011 13:30:14 GMT
Ha ! I tried to send this message all day long, but received "Mail
errors because the server thought that it is spam :). Trying again,
some suspicious words with others (I really don't understand how such a
and technical message can be perceived as spam !):

Thanks for posting the code, it clarifies your question.

So you add two documents with categories n/m and n/s respectively. You
using MatchAllDocs and ask to count the 'neighborhood' dimension, and
the counts n/m=1 and n/s=1, as expected.

You then execute a drill-down query on n/m, again asking to count the 'n'
dimension. This time you only get n/m=1 because that's the only result that
returned by your query.

This is not common -- i.e., when users click a certain category, they
indicate that they want to explore that category further in the context of
their original text query. Usually, the UI then asks to count that category
(i.e., count n/m), or count a different category altogether.

If in your case you still want to show the original counts, then don't ask
to re-count categories in drill-down queries. If it's a plain Java program,
then don't use FacetsCollector at all for the second query. If it's a UI,
then you can use AJAX to update just the documents' results section,
without the facets widget.

Otherwise, the only solution I see (besides running two queries) is to
use a special Collector which filters out documents that do not match
the drill-down criteria. I.e., if your query is MatchAllDocs, then you
create the FacetsCollector regularly, and then you write a Collector
which receives the drill-down Term and say TopScoredDocsCollector. The
query execution will return all documents, so the FacetsCollector will
count all results, but your custom Collector will filter out results
that do not match the drill-down criteria.

This is more expensive than simply not counting facets for drill-down
queries and use the original counts. If you cannot do AJAX, then perhaps
you can serialize the facet counts back and forth, or some other solution.
I would use the last solution I proposed as a last resort only. I don't
think it's *much* more expensive, but you'll need to write some code.


On Fri, Dec 2, 2011 at 8:42 PM, Tobias Knaup <> wrote:

> Hi Shai,
> Thanks for your response. Here is some example code that illustrates the
> problem:
> Thanks
> Tobi
> On Fri, Dec 2, 2011 at 8:31 AM, Shai Erera <> wrote:
> > Hi Tobi,
> >
> > What is the facet request that you define for the drill down query? I.e.,
> > if your initial query was 'foo' and you asked to count facet ABC. Then
> the
> > user clicks one of he categories of facet ABC (that's your drill down
> > query) -- what is the facet the you ask to count for the drill down
> query?
> >
> > If I misunderstood your question, do you have a small test case that
> shows
> > the problem, or can write some mock up code, that explains it?
> >
> > Shai
> >
> > On Friday, December 2, 2011, Tobias Knaup <> wrote:
> > > Hi all,
> > >
> > > I have a question about facet counts and drill down queries.
> > > When I run a drill down query, I only get counts for the category in
> the
> > > query, but I need the counts for all categories.
> > > Is there a way to do this without running two separate searches?
> > > I'm using a MultiCollector to wrap a TopDocsCollector and
> > FacetsCollector.
> > >
> > > Thanks for your help!
> > >
> > > Tobi
> > >
> >

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message