1
votes

I want to facet on a specific field. The field is defined as

<field name="specials_de" type="textgen" indexed="true" stored="true" multiValued="true"/>

Two of the values in specials_de are "Cunard Hamburg Specials" and "Cunard the New Yorker". I want to use these two values as facets, but the solr query returns facet fields with values like

<int name="cunard">11</int>
<int name="new">9</int>
<int name="yorker">9</int>
<int name="hamburg">5</int>
<int name="hamburgspecialscunard">3</int>
<int name="hamburgspecials">2</int>

What am I doing wrong?

Just to clarify: I'm not referring to the counts (11, 9, etc.), but to the names, i.e. "cunard", "new", etc.

1

1 Answers

2
votes

Text fields are not suggested to be used for Faceting. You won't get the desired behavior as the text fields would be tokenized and filtered leading to the generation of multiple tokens which you see from the facets returned as response.

SolrFacetingOverview :-

Because faceting fields are often specified to serve two purposes, human-readable text and drill-down query value, they are frequently indexed differently from fields used for searching and sorting:

  1. They are often not tokenized into separate words
  2. They are often not mapped into lower case
  3. Human-readable punctuation is often not removed (other than double-quotes)
  4. There is often no need to store them, since stored values would look much like indexed values and the faceting mechanism is used for value retrieval.

Try to use String fields and it would be good enough without any overheads.