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 Evgeniy Strokin <ev...@yahoo.com> on 2008/01/11 16:33:09 UTC

2D Facet

Hello, is this possible to do in one query:
I have a query which returns 1000 documents with names and addresses. I can run facet on state field and see how many addresses I have in each state. But also I need to see how many families lives in each state. So as a result I need a matrix of states on top and Last Names on right.
After my first query, knowing which states I have I can run queries on each state using facet field Last_Name. But I guess this is not an efficient way.
Is this possible to get in one query? Or may be some other way?
 
Thank you
Gene

Re: 2D Facet

Posted by Chris Hostetter <ho...@fucit.org>.
: 
: Hello, is this possible to do in one query: I have a query which returns 
: 1000 documents with names and addresses. I can run facet on state field 
: and see how many addresses I have in each state. But also I need to see 
: how many families lives in each state. So as a result I need a matrix of 
: states on top and Last Names on right. After my first query, knowing 
: which states I have I can run queries on each state using facet field 
: Last_Name. But I guess this is not an efficient way. Is this possible to 
: get in one query? Or may be some other way?

if you set rows=0 on all of those queries it won't be horribly inefficient 
... the DocSets for each state and lastname should wind up in the 
filterCache, so most of the queries will just be simple DocSet 
intersections with only the HTTP overhead (which if you use persistent 
connections should be fairly minor)

The idea of generic multidimensional faceting is acctaully pretty 
interesting ... it could be done fairly simply -- imagine if for every 
facet.field=foo param, solr checked for a f.foo.facet.matrix params, and 
once the top facet.limit terms were found for field "foo" it then 
computed the top facet founds for each f.foo.facet.matrix field 
with an implicit fq=foo:term.

that would be pretty cool.


-Hoss