lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Hostetter <hossman_luc...@fucit.org>
Subject Re: Having an issue with pivot faceting
Date Thu, 09 Oct 2014 00:34:23 GMT

: Subject: Having an issue with pivot faceting

Ok - first off -- your example request doens't include any "facet.pivot" 
params, so you aren't using pivot faceting .. which makes me concerned 
that if you aren't using the feature you think you are, or don't 
understand the feature you are using.

: I'm having an issue getting pivot faceting working as expected.  I'm trying
: to filter by a specific criteria, and then first facet by one of my document
: attributes called item_generator, then facet those results into 2 sets each:
: the first set is the count of documents satisfying that facet with
: number_of_items_generated set to 0, the other set counting the documents
: satisfying that facet with number_of_items_generated greater than 0.  Seems

second:: interval faceting is just a fancy, more efficient, way of 
using "facet.query" if your queries are always over ranges.  there's 
nothing about interval faceting that is directly related to pivot 
faceting.

third: there isn't currently any generic support for faceting by a field, 
and then facet "those results" by some other field/criteria.  This is 
actively being worked on in issues like SOLR-6348 - but it doens't exist 
yet.

fourth: because you ultimately have a specific citeria for how 
you want to divide the facets, something similar to the behavior you are 
asking is available using "taged exclusions" on facets....

https://cwiki.apache.org/confluence/display/solr/Faceting#Faceting-LocalParametersforFaceting

...the basic idea you could follow is that you send additional fq params 
for each of the 2 criteria you want to lump things into 
(number_of_items_generated<0 and number_of_items_generated>0) but you tag 
those filters so they can individuall be "excluded" from facets -- then 
you use facet.field on your item_generator field twice (with different 
keys)  and in each case you exclude only one of those filters.

Here's a similar example to what you describe using the sample data that 
comes with solr...

http://localhost:8983/solr/select?rows=0&debug=query&q=inStock:true&fq={!tag=pricey}price:[100%20TO%20*]&fq={!tag=cheap}price:[*%20TO%20100}&facet=true&facet.field={!key=cheap_cats%20ex=pricey}cat&facet.field={!key=pricey_cats%20ex=cheap}cat

so "cheap_cats" gives you facet counts on the "cat" field but only for the 
"cheap" products (because it excludes the "pricey" fq) and "pricey_cats" 
gives you facet counts on the "cat" field for the "pricey" products by 
excluding the "cheap" fq.

note however that the numFound is 0 -- this works fine for getting the 
facet counts you wnat, but you'd need a second query q/ the filters to get 
the main result set since (i'm pretty sure) it's not possible to use "ex" 
on the main query to exclude filters from affecting the main result set.


-Hoss
http://www.lucidworks.com/

Mime
View raw message