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 Rubinho <ru...@gekiere.com> on 2011/11/10 14:13:45 UTC

Facet counts incorrect on filtered field when using groups

Hi,

I have a problem with facets on a grouped field.

Ex: SolR has 3 records, 2 records with the same RountripgroupCode and
CountryCode ("MA"), and 1 record with another roundtripgroupCode and another
CountryCode ("ID").
Because i use grouping, i should have only have 1 result in MA and 1 result
in ID.
When executing the query below, i get a facetresult of 2 on the CountryCode
MA (it should be 1) and 1 on ID.

If i remove the line fq={!tag=CC}CountryCode:MA, then the facetresults are
correct: 1 for each CountryCode.

How can i solve this, so that i'll have the same result with filter on
Countrycode?


http://zrheab21:9090/solr/select?
facet=true&
facet.field={!ex=CC}CountryCode&
facet.field=IsBeach&
fq={!tag=CC}CountryCode:MA&
group=true&
group.truncate=true&
group.field=RoundtripgroupCode&
q=*:*



--
View this message in context: http://lucene.472066.n3.nabble.com/Facet-counts-incorrect-on-filtered-field-when-using-groups-tp3496683p3496683.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Facet counts incorrect on filtered field when using groups

Posted by Rubinho <ru...@gekiere.com>.
Hi Erick,

Well, these records are trips, each trip has multiple variants
(departuredates, number of days). Each variant has his own record. 
Grouping is used to show only 1 record/trip.

When you search in this minidatabase (with 3 records) without a fq, then you
receive 1 facetcount (grouped by the tripcode) for the country 'MA'. But if
you have specified in the searchfields to search for trips in the country
'MA' (just adding &facet.query={!tag=CC}CountryCode:MA), then i receive a
count of 2 for this Country. This is the number of the records and not of
the grouped items.

The reason i use &facet.query={!tag=CC}CountryCode:MA is explained here: 
http://wiki.apache.org/solr/SimpleFacetParameters#Tagging_and_excluding_Filters
http://wiki.apache.org/solr/SimpleFacetParameters#Tagging_and_excluding_Filters 


Maybe, the system doesn't know that each record in the same group has the
same CountryCode. I think this is maybe the reason why i get not the
expected results.

It's difficult to put the Solr instance online, but here are the results as
you asked: http://users.telenet.be/rgekiere/solr/
http://users.telenet.be/rgekiere/solr/  

--
View this message in context: http://lucene.472066.n3.nabble.com/Facet-counts-incorrect-on-filtered-field-when-using-groups-tp3496683p3502145.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Facet counts incorrect on filtered field when using groups

Posted by Erick Erickson <er...@gmail.com>.
Hmmm, something's not making sense here.

First, grouping shouldn't affect faceting as far as
I understand, they're two entirely
different constructs. Why would you expect specifying
grouping to affect facet counts?

Second, what is this all about?
fq={!tag=CC}CountryCode:MA&
It looks like you're mixing filter query with facet
query syntax, maybe this is causing some
kind of strange behavior? Because I can't
reconcile your statement that if you remove that
your facet counts are 1 for both MA and ID.

So can you show the complete output with
&debugQuery=on for the two results?

Best
Erick



On Thu, Nov 10, 2011 at 8:13 AM, Rubinho <ru...@gekiere.com> wrote:
> Hi,
>
> I have a problem with facets on a grouped field.
>
> Ex: SolR has 3 records, 2 records with the same RountripgroupCode and
> CountryCode ("MA"), and 1 record with another roundtripgroupCode and another
> CountryCode ("ID").
> Because i use grouping, i should have only have 1 result in MA and 1 result
> in ID.
> When executing the query below, i get a facetresult of 2 on the CountryCode
> MA (it should be 1) and 1 on ID.
>
> If i remove the line fq={!tag=CC}CountryCode:MA, then the facetresults are
> correct: 1 for each CountryCode.
>
> How can i solve this, so that i'll have the same result with filter on
> Countrycode?
>
>
> http://zrheab21:9090/solr/select?
> facet=true&
> facet.field={!ex=CC}CountryCode&
> facet.field=IsBeach&
> fq={!tag=CC}CountryCode:MA&
> group=true&
> group.truncate=true&
> group.field=RoundtripgroupCode&
> q=*:*
>
>
>
> --
> View this message in context: http://lucene.472066.n3.nabble.com/Facet-counts-incorrect-on-filtered-field-when-using-groups-tp3496683p3496683.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>