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 Chris Hostetter <ho...@fucit.org> on 2012/08/14 03:17:09 UTC

Re: Query facet count and its matching documents

: We're passing multiple Arbitrary Faceting Query (facet.query) to get the
: number of matching documents (the facet count) evaluated over the search
: results in a *single* Solr query.  My use case demands the actual matching
: facet results/documents/fields also along with facet count.
: 
: My question is, is it possible to get facet query matching results along
: with facet count in a single Solr query call?

nope .. there's nothing in Solr to give you these results in a single 
query -- you could write a component to do something like this, but you'd 
have to think about how you want to deal with the fl/start/rows of these 
extra queries.

Note: one thing you can do with the psudo-fields feature of Solr 4.0-ALPHA 
is include a psuedo-field with each document in the main result 
set indicating it's score from arbitrary queries -- including tose queries 
you are using in facet.query.

Something like this works with the Solr 4.0-ALPHA example data...

http://localhost:8983/solr/select
?q=*:*
&apple=name:apple
&electronics=cat:electronics
&facet=true
&facet.query={!key=apple v=$apple}
&facet.query={! key=electronics v=$electronics}
&fl=id,electronics:query($electronics),apple:query($apple)






-Hoss