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 Brian Lucas <bl...@gmail.com> on 2006/09/22 01:08:41 UTC

dismax and facets with constraints

I'm experimenting with dismax to do faceted browsing, and when I add a
constraint with dismax on that facet, I no longer get the entire
facet-count.

 

i.e.

 

q=blah&qt=dismax&fq=type_id:1&hl=true&hl.fl=title+summary&hl.snippets=3&face
t=true&facet.limit=-1&facet.zeros=false&facet.field=type_id

 

<lst name="facet_counts">

<lst name="facet_queries"/>

            <lst name="facet_fields">

            <lst name="type_id">

<int name="2">95</int>

</lst>

</lst>

</lst>

 

 

I understand why this is happening, but is there another way to add a
constraint via querystring (instead of 'fq=type_id:1') and still get the
full facet-counts list?

 

I can do it with standardrequest, but then it doesn't appear like I can sort
the results.

 

 


Re: dismax and facets with constraints

Posted by Chris Hostetter <ho...@fucit.org>.
: I'm experimenting with dismax to do faceted browsing, and when I add a
: constraint with dismax on that facet, I no longer get the entire
: facet-count.

that sounds expected ... when you add a constraint using "fq" (or adding
new clauses to the main query) the overall result set is going to get
smaller, and the counts are going ot be affected ... this is typically
what people want when they do faceted searching -- as they drill down the
counts should reflect their narrowed few of the world.  If they didn't
change, then you would have missleading info about the options available
to you.

if you really want "global" counts for the search, independent of the
constraints applied, just do two queries, one with and one without

One thing that confuses me though...

: q=blah&qt=dismax&fq=type_id:1&hl=true&hl.fl=title+summary&hl.snippets=3&face
: t=true&facet.limit=-1&facet.zeros=false&facet.field=type_id
	...
: <lst name="facet_counts">
: <lst name="facet_queries"/>
:             <lst name="facet_fields">
:             <lst name="type_id">
: <int name="2">95</int>
: </lst>
: </lst>
: </lst>

that URL doesn't seem to jive with that response, if you've constraint to
type_id:1 your type_id facet count list should contain "1" ... it might
also contain "2" if type_id is a multivalue field and there are some docs
that have both "1" and "2", but i can't figure out why you only have a "2"
there ... does that URL really match what you are getting back from Solr,
or is this a cut/paste mistake?



-Hoss