You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by Dennis de Boer <da...@gmail.com> on 2011/06/18 14:06:29 UTC

faceting on multivalued fields

Hello all,

I'm new to this list, so if I don't use it correctly, please say so.

I have a question about facetting on multivalued fields. I have indexed some
data from a product feed. One of my fields, the category field, is a
multivalued field.
This field contains multiple categories related to the product. For example
when I index a product feed composed of fashion items the category field can
be filled with
the values "women men boys" when this piece of clothing is available for
women, men and boys.

Like I said I indexed the category as a multivalued field. Now I want to
facet on it. Facetation works, however, not as expected.
When I query Solr with the following URL
q=*:*&facet=true&facet.field=category&fq=category:women, I receive the
following response

<int name="women">71</int>
<int name="men">6</int>
<int name="babies">1</int>
<int name="baby">0</int>
<int name="boys">0</int>
<int name="girls">0</int>

It looks like Solr returns every document where 'women' is part of the
multivalued category field, but also returns the facets(count) for all
keywords that where indexed as part of the multivalued field, along with
'Women'. In this example I got back documents which had the category field
indexed like  "women men" , "women babies" and "women babies men".

What is worse, since it also calculates the facets for babies and men, when
I put another facet.field in the query (like brand), the response also
returns brands for categories men and babies.

Is this as designed? Is there a way to let Solr *only* return the documents
which have 'women' in their category field?


Thanks a lot for the help!

Regards,
Dennis

Re: faceting on multivalued fields

Posted by Jayendra Patil <ja...@gmail.com>.
As Mohanty said, your facet field seems to be analysed with the white
space tokenizer (field type probably text) which would generate
individual tokens for category - women babies men and hence the
individual facets.
You should use string as the field type for category so that it is not
tokenized.

Regards,
Jayendra

On Sat, Jun 18, 2011 at 11:50 AM, Gora Mohanty <go...@mimirtech.com> wrote:
> On Sat, Jun 18, 2011 at 5:36 PM, Dennis de Boer <da...@gmail.com> wrote:
>> Hello all,
>>
>> I'm new to this list, so if I don't use it correctly, please say so.
>>
>> I have a question about facetting on multivalued fields. I have indexed some
>> data from a product feed. One of my fields, the category field, is a
>> multivalued field.
> [...]
>
> Please show us the definition of this field in the Solr schema,
> including the tokenizers/analyzers on the field type. My guess
> is that your facet field is getting analyzed. This might be of help:
> http://wiki.apache.org/solr/SolrFacetingOverview
>
> Regards,
> Gora
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
> For additional commands, e-mail: dev-help@lucene.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


Re: faceting on multivalued fields

Posted by Gora Mohanty <go...@mimirtech.com>.
On Sat, Jun 18, 2011 at 5:36 PM, Dennis de Boer <da...@gmail.com> wrote:
> Hello all,
>
> I'm new to this list, so if I don't use it correctly, please say so.
>
> I have a question about facetting on multivalued fields. I have indexed some
> data from a product feed. One of my fields, the category field, is a
> multivalued field.
[...]

Please show us the definition of this field in the Solr schema,
including the tokenizers/analyzers on the field type. My guess
is that your facet field is getting analyzed. This might be of help:
http://wiki.apache.org/solr/SolrFacetingOverview

Regards,
Gora

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org