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 Luis Lebolo <lu...@gmail.com> on 2013/11/21 22:22:01 UTC

Facet field query on subset of documents

Hi All,

Is it possible to perform a facet field query on a subset of documents (the
subset being defined via a filter query for instance)?

I understand that facet pivoting might work, but it would require that the
subset be defined by some field hierarchy, e.g. manufacturer -> price (then
only look at the results for the manufacturer I'm interested in).

What if I wanted to define a more complex subset (where the name starts
with A but ends with Z and some other field is greater than 5 and yet
another field is not 'x', etc.)?

Ideally I would then define a "facet field constraining query" to include
only terms from documents that pass this query.

Thanks,
Luis

Re: Facet field query on subset of documents

Posted by Toby Lazar <tl...@capitaltg.com>.
Luis (or anyone else),

Did you ever find a solution for this problem?  If not, is querying twice
the way to go?  I'm looking to do the same with no luck yet.

Thanks,

Toby

*******************************
  Toby Lazar
  Capital Technology Group
  Email: tlazar@capitaltg.com
  Mobile: 646-469-5865
*******************************


On Thu, Nov 21, 2013 at 5:44 PM, Luis Lebolo <lu...@gmail.com> wrote:

> Hi Erick,
>
> Thanks for the reply and sorry, my fault, wasn't clear enough. I was
> wondering if there was a way to remove terms that would always be zero
> (because the term came from a document that didn't match the filter query).
>
> Here's an example. I have a bunch of documents with fields 'manufacturer'
> and 'location'. If I set my filter query to "manufacturer = Sony" and all
> Sony documents had a value of 'Florida' for location, then I want 'Florida'
> NOT to show up in my facet field results. Instead, it shows up with a count
> of zero (and it'll always be zero because of my filter query).
>
> Using mincount = 1 doesn't solve my problem because I don't want it to hide
> zeroes that came from documents that actually pass my filter query.
>
> Does that make more sense?
>
>
> On Thu, Nov 21, 2013 at 4:36 PM, Erick Erickson <erickerickson@gmail.com
> >wrote:
>
> > That's what faceting does. The facets are only tabulated
> > for documents that satisfy they query, including all of
> > the filter queries and anh other criteria.
> >
> > Otherwise, facet counts would be the same no matter
> > what the query was.
> >
> > Or I'm completely misunderstanding your question...
> >
> > Best,
> > Erick
> >
> >
> > On Thu, Nov 21, 2013 at 4:22 PM, Luis Lebolo <lu...@gmail.com>
> > wrote:
> >
> > > Hi All,
> > >
> > > Is it possible to perform a facet field query on a subset of documents
> > (the
> > > subset being defined via a filter query for instance)?
> > >
> > > I understand that facet pivoting might work, but it would require that
> > the
> > > subset be defined by some field hierarchy, e.g. manufacturer -> price
> > (then
> > > only look at the results for the manufacturer I'm interested in).
> > >
> > > What if I wanted to define a more complex subset (where the name starts
> > > with A but ends with Z and some other field is greater than 5 and yet
> > > another field is not 'x', etc.)?
> > >
> > > Ideally I would then define a "facet field constraining query" to
> include
> > > only terms from documents that pass this query.
> > >
> > > Thanks,
> > > Luis
> > >
> >
>

Re: Facet field query on subset of documents

Posted by Luis Lebolo <lu...@gmail.com>.
Hi Erick,

Thanks for the reply and sorry, my fault, wasn't clear enough. I was
wondering if there was a way to remove terms that would always be zero
(because the term came from a document that didn't match the filter query).

Here's an example. I have a bunch of documents with fields 'manufacturer'
and 'location'. If I set my filter query to "manufacturer = Sony" and all
Sony documents had a value of 'Florida' for location, then I want 'Florida'
NOT to show up in my facet field results. Instead, it shows up with a count
of zero (and it'll always be zero because of my filter query).

Using mincount = 1 doesn't solve my problem because I don't want it to hide
zeroes that came from documents that actually pass my filter query.

Does that make more sense?


On Thu, Nov 21, 2013 at 4:36 PM, Erick Erickson <er...@gmail.com>wrote:

> That's what faceting does. The facets are only tabulated
> for documents that satisfy they query, including all of
> the filter queries and anh other criteria.
>
> Otherwise, facet counts would be the same no matter
> what the query was.
>
> Or I'm completely misunderstanding your question...
>
> Best,
> Erick
>
>
> On Thu, Nov 21, 2013 at 4:22 PM, Luis Lebolo <lu...@gmail.com>
> wrote:
>
> > Hi All,
> >
> > Is it possible to perform a facet field query on a subset of documents
> (the
> > subset being defined via a filter query for instance)?
> >
> > I understand that facet pivoting might work, but it would require that
> the
> > subset be defined by some field hierarchy, e.g. manufacturer -> price
> (then
> > only look at the results for the manufacturer I'm interested in).
> >
> > What if I wanted to define a more complex subset (where the name starts
> > with A but ends with Z and some other field is greater than 5 and yet
> > another field is not 'x', etc.)?
> >
> > Ideally I would then define a "facet field constraining query" to include
> > only terms from documents that pass this query.
> >
> > Thanks,
> > Luis
> >
>

Re: Facet field query on subset of documents

Posted by Erick Erickson <er...@gmail.com>.
That's what faceting does. The facets are only tabulated
for documents that satisfy they query, including all of
the filter queries and anh other criteria.

Otherwise, facet counts would be the same no matter
what the query was.

Or I'm completely misunderstanding your question...

Best,
Erick


On Thu, Nov 21, 2013 at 4:22 PM, Luis Lebolo <lu...@gmail.com> wrote:

> Hi All,
>
> Is it possible to perform a facet field query on a subset of documents (the
> subset being defined via a filter query for instance)?
>
> I understand that facet pivoting might work, but it would require that the
> subset be defined by some field hierarchy, e.g. manufacturer -> price (then
> only look at the results for the manufacturer I'm interested in).
>
> What if I wanted to define a more complex subset (where the name starts
> with A but ends with Z and some other field is greater than 5 and yet
> another field is not 'x', etc.)?
>
> Ideally I would then define a "facet field constraining query" to include
> only terms from documents that pass this query.
>
> Thanks,
> Luis
>