2

I am working on adding facets to my Solr queries and I am getting some odd results.

Let's say that I have a list of manufacturers that I want to have faceted. This list would include:

Port Authority
Carhartt Clothing
Dickies Uniforms

My facets for this come back as:

<int name="port">157</int>
<int name="authority">156</int>
<int name="clothing">156</int>
<int name="carhartt">105</int>
<int name="uniforms">67</int>
<int name="dickies">58</int>

Is there a way to make the facets use the full value, not split on each word? I have defined manufactuer in my schema.xml file as:

<field name="manufacturer" type="text_general" indexed="true" stored="true" multiValued="false"/>

I largely have the default schema.xml file that is in the example directory when you download Solr. The only thing I changed from the default example was add my fields.

Josh Pennington
  • 288
  • 1
  • 6
  • 21
  • Have you tried this question on Stack Overflow? It seems like something that might get a better response there. – pjmorse Jan 04 '13 at 16:51
  • @pjmorse http://meta.stackexchange.com/a/161487/155556 – Naftali Jan 04 '13 at 17:58
  • Nice! To be clear, I don't think the question doesn't belong here; this is definitely a gray area from my POV. I suggested SO because when in doubt there are just more eyes there. I'll follow up on the meta thread. – pjmorse Jan 04 '13 at 18:52

1 Answers1

1

One easy way to do that is copy you data to a specific facet field. You usually don't want tokenization or any other changes to you facet field.

For example, at you solr schema.xml you can do

<copyField source="manufacturer" dest="manufacturerFacet"/>

This will copy the data you try to store at the manufacturer field to the manufacturerFacet automatically. This way you can set manufacturerFacet field as the following using string as base standard type with no tokenization.

<field name="manufacturerFacet" type="string" indexed="true" stored="false" multiValued="true"/>
<fieldType name="string" class="solr.StrField" sortMissingLast="true" omitNorms="true"/>
Tadeu Maia
  • 176
  • 2