Mailing List Archive

RangeFacetsCount Question
Hi,

I had a quick question about RangeFacetsCounts
<https://github.com/apache/lucene/blob/a071180a806d1bb7ae11ae30a07e43e452bea810/lucene/facet/src/java/org/apache/lucene/facet/range/RangeFacetCounts.java#L65>,
I'm a bit confused by the fastMatchQuery param. Specifically, I was
wondering why we need this when we can provide hits from a FacetCollector
directly without having to run a query? I realize that the fastMatchQuery
is used for filtering provided hits further, but it seems redundant when we
can do all the matching we need before providing the FacetCollector object
to RangeFacetCounts. SortedSetDocValuesFacetCounts only has FacetCollector
as a param for example
<https://github.com/apache/lucene/blob/a071180a806d1bb7ae11ae30a07e43e452bea810/lucene/facet/src/java/org/apache/lucene/facet/sortedset/SortedSetDocValuesFacetCounts.java#L89>
without
having the fastMatchQuery param. Maybe I'm misunderstanding something here?
If anyone has an explanation that would be super helpful!

Thanks!
Marc D'Mello
Re: RangeFacetsCount Question [ In reply to ]
Looking at git blame I see the current parameter was added here:
https://issues.apache.org/jira/browse/LUCENE-6648. Previous
implementations supported a BitSet rather than a Query. I'm not really
sure what the use case is for applying additional filtering when
faceting. Perhaps it can support something like drill sideways??

On Thu, Apr 21, 2022 at 6:08 PM Marc D'Mello <marcd2000@gmail.com> wrote:
>
> Hi,
>
> I had a quick question about RangeFacetsCounts
> <https://github.com/apache/lucene/blob/a071180a806d1bb7ae11ae30a07e43e452bea810/lucene/facet/src/java/org/apache/lucene/facet/range/RangeFacetCounts.java#L65>,
> I'm a bit confused by the fastMatchQuery param. Specifically, I was
> wondering why we need this when we can provide hits from a FacetCollector
> directly without having to run a query? I realize that the fastMatchQuery
> is used for filtering provided hits further, but it seems redundant when we
> can do all the matching we need before providing the FacetCollector object
> to RangeFacetCounts. SortedSetDocValuesFacetCounts only has FacetCollector
> as a param for example
> <https://github.com/apache/lucene/blob/a071180a806d1bb7ae11ae30a07e43e452bea810/lucene/facet/src/java/org/apache/lucene/facet/sortedset/SortedSetDocValuesFacetCounts.java#L89>
> without
> having the fastMatchQuery param. Maybe I'm misunderstanding something here?
> If anyone has an explanation that would be super helpful!
>
> Thanks!
> Marc D'Mello

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
Re: RangeFacetsCount Question [ In reply to ]
I wonder if the idea is that fastMatchQuery provides additional
filtering to only documents that might match one of the ranges being
faceted on. As a (somewhat contrived) example, what if you were
searching over items in an ecommerce catalog that all contain an
indexed numeric "price" attribute, and then wanted to facet on the
price ranges $50 - $100 and $100 - $200. Imagine your query didn't
contain any price constraint, so your hits could have any possible
price. Instead of iterating over everything in the FacetsCollector and
discovering that many of the hits don't fall into either of these
ranges, maybe it would make sense to provide a fastMatchQuery for all
docs with a price of $50 - $200 -- leveraging the points index -- to
provide additional filtering of the FacetsCollector hits before
running the count loop.

Whether-or-not this is actually more efficient in some scenarios, I'm
not sure. But that's a (again, somewhat contrived), example I can cook
up that might explain the utility of this. If anyone knows better, I'd
love to hear more :)

Cheers,
-Greg

On Tue, Apr 26, 2022 at 12:14 PM Michael Sokolov <msokolov@gmail.com> wrote:
>
> Looking at git blame I see the current parameter was added here:
> https://issues.apache.org/jira/browse/LUCENE-6648. Previous
> implementations supported a BitSet rather than a Query. I'm not really
> sure what the use case is for applying additional filtering when
> faceting. Perhaps it can support something like drill sideways??
>
> On Thu, Apr 21, 2022 at 6:08 PM Marc D'Mello <marcd2000@gmail.com> wrote:
> >
> > Hi,
> >
> > I had a quick question about RangeFacetsCounts
> > <https://github.com/apache/lucene/blob/a071180a806d1bb7ae11ae30a07e43e452bea810/lucene/facet/src/java/org/apache/lucene/facet/range/RangeFacetCounts.java#L65>,
> > I'm a bit confused by the fastMatchQuery param. Specifically, I was
> > wondering why we need this when we can provide hits from a FacetCollector
> > directly without having to run a query? I realize that the fastMatchQuery
> > is used for filtering provided hits further, but it seems redundant when we
> > can do all the matching we need before providing the FacetCollector object
> > to RangeFacetCounts. SortedSetDocValuesFacetCounts only has FacetCollector
> > as a param for example
> > <https://github.com/apache/lucene/blob/a071180a806d1bb7ae11ae30a07e43e452bea810/lucene/facet/src/java/org/apache/lucene/facet/sortedset/SortedSetDocValuesFacetCounts.java#L89>
> > without
> > having the fastMatchQuery param. Maybe I'm misunderstanding something here?
> > If anyone has an explanation that would be super helpful!
> >
> > Thanks!
> > Marc D'Mello
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org