All facet counts currently returned are _within_ the set of documents constrained by query (q) and filter query (fq) parameters - just to clarify what it does. Why? That's the general use case. Returning back counts from differently constrained sets requires some custom coding - perhaps as a custom facet plugin? (not sure if that'd do the trick or not), but certainly a custom request handler would be able to manage this.

Worst case, make two requests to Solr, of course. Less than ideal, but pragmatic, and not necessarily a bad performer, especially with HTTP caching in the mix.

[back in the day, the Collex @ NINES site made 3 requests to Solr for every page view just to keep things simple architecturally for a while.... one to get the search results and facets, one to render a tag cloud given different criteria, and one simply to get the total count of objects in the entire system to show at the bottom of the page for hype/marketing purposes]

        Erik

On Jul 22, 2008, at 9:39 AM, Jon Baer wrote:

This is *exactly* my issue ... very nicely worded :-)

I would have thought facet.query=*:* would have been the solution but it does not seem to work. Im interested in getting these *total* counts for UI display.

- Jon

On Jul 22, 2008, at 6:05 AM, Stefan Oestreicher wrote:

Hi,

I have a category field in my index which I'd like to use as a facet.
However my search frontend only allows you to search in one category at a time for which I'm using a filter query. Unfortunately the filter query
restricts the facets as well.

My query looks like this:
? q = content:foo &fq=cat:default&fl=title,content&facet=true&facet.field=cat

What I'd like is to search only in the "default" category but get the result
count of that query for all categories. I thought maybe I can use the
facet.query parameter but this doesn't seem to do what I want, because the
result is the same.

Is there any way to accomplish this with only one request?

I'm using version 1.3 from trunk.

TIA,

Stefan Oestreicher


Reply via email to