简体   繁体   中英

solr facet field values appear to be generated by solr

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, ie "cunard", "new", etc.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM