Solr faceting only counts documents that satisfy the query. Think of it
as assembling a list of all possible values for a field and then adding
1 for each value found in each document that satisfies the overall
query (including the filter query). So you can get counts of 0, that's
expected. Adding mincount=1 will keep these from being returned.

I suspect that your query is not finding the documents you think it is or your
filter query is not parsed as you expect. If you add &debugQuery=on you'll
see the parsed form of both. In particular, look for your complex fq to be
broken up and distributed with some parts against your portal_uuid and
some against the default search field. In particular, '+' and '-' are
operators and the top-level parsers may be splitting these up. Quoting or
parenthesizing may help.

Best
Erick

On Sun, Jul 8, 2012 at 2:32 AM, Chamnap Chhorn <chamnapchh...@gmail.com> wrote:
> Hi all,
>
> I have a question related to solr 3.5 on field facet. Here is my query:
>
> http://localhost:8081/solr_new/select?tie=0.1&q.alt=*:*&q=bank&qf=nameaddress&fq=
> *portal_uuid:+A4E7890F-A188-4663-89EB-176D94DF6774*&defType=dismax&*
> facet=true*&facet.field=*location_uuid*&facet.field=*sub_category_uuids*
>
> What I get back with field facet are:
> 1. Some location_uuids which is in the current portal_uuid (has facet count
>> 0)
> 2. Some location_uuids are not in the current portal_uuid at all (has facet
> count = 0)
>
> It seems that solr doesn't honor the fq at all when returning field facet.
> I need to add one more parameter "facet.mincount=1" in order to not return
> location_uuids facet (2).
>
> I think, solr does faceting on all location_uuid. It should does that
> scoping to current portal_uuid. Any idea?
>
> --
> Chhorn Chamnap
> http://chamnap.github.com/

Reply via email to