q and fq queries don't necessarily run through the same query parser, see:
http://wiki.apache.org/solr/SimpleFacetParameters#facet.query_:_Arbitrary_Query_Faceting

So try adding &debugQuery=on to both queries you submitted. My guess
is that if you look at the parsed queries, you'll see something that explains
your differences. If not, paste the results back and we can take a look.

BTW, ignore all the "explain" bits for now, the important bit is the parsed form
of q and fq in your queries.

Best
Erick

On Sat, Jul 14, 2012 at 5:11 AM, tudor <tudor.zaha...@gmail.com> wrote:
> Hello,
>
> I am new to Solr and I running some tests with our data in Solr. We are
> using version 3.6 and the data is imported form a DB2 database using Solr's
> DIH. We have defined a single entity in the db-data-config.xml, which is an
> equivalent of the following query:
> <entity name="connections"
>         query="
>         SELECT C.NAME,
>                    F.CITY
>                 FROM
>                 NAME_CONNECTIONS AS C
>                 JOIN NAME_DETAILS AS F
>                 ON C.DETAILS_NAME = F.NAME"
>>
> </entity>
>
> This might lead to some names appearing multiple times in the result set.
> This is OK.
>
> For the unique ID in the schema, we are using a solr.UUIDField:
>
> <fieldType name="uuid" class="solr.UUIDField" indexed="true" />
> <field name=&quot;id&quot; type=&quot;uuid&quot; indexed=&quot;true&quot;
> stored=&quot;true&quot; default=&quot;NEW&quot;/
>
> All the searchable fields are declared as indexed and stored.
>
> I am aware of the fact that this is a very crude configuration, but for the
> tests that I am running it is fine.
>
> The problem that I have is the different result counts that I receive when I
> do equivalent queries for searching and faceting. For example, running the
> following query
>
> http://localhost:8983/solr/db/select?indent=on&amp;version=2.2&amp;q=CITY:MILTON&amp;fq=&amp;start=0&amp;rows=100&amp;fl=*&amp;wt=&amp;explainOther=&amp;hl.fl=&amp;group=true&amp;group.field=NAME&amp;group.ngroups=true&amp;group.truncate=true
>
> yields
>
> &lt;int name=&quot;ngroups&quot;>134</int>
>
> as a result, which is exactly what we expect.
>
> On the other hand, running
>
> http://localhost:8983/solr/db/select?indent=on&version=2.2&q=*&fq=&start=0&rows=10&fl=*&wt=&explainOther=&hl.fl=&group=true&group.field=NAME&group.truncate=true&facet=true&facet.field=CITY&group.ngroups=true
>
> yields
>
> <lst name="facet_counts">
>    <lst name="facet_queries"/>
>      <lst name="facet_fields">
>       <lst name="CITY">
> <int name="MILTON">103</int>
>
> I would expect to have the same number (134) in this facet result as well.
> Could you please let me know why these two results are different?
>
> Thank you,
> Tudor
>
>
>
> --
> View this message in context: 
> http://lucene.472066.n3.nabble.com/Query-results-vs-facets-results-tp3994988.html
> Sent from the Solr - User mailing list archive at Nabble.com.

Reply via email to