Question

I am trying to do a facet search on the following field:

<field name="productTaxonomyName" type="text_en" indexed="true" stored="true" multiValued="false" />

the result for the facet search select?q=gold&rows=0&wt=json&indent=true&facet=true&facet.query=gold&facet.field=productTaxonomyName were:

facet_fields":{
  "productTaxonomyName":[
    "set",2018,
    "necklac",1937,
    "ear",1761,
    "ring",750,
    "pendant",524,
    "bracelet",348,
    "anklet",112,

The field values should be necklace sets, necklaces, earrings, mangalsutras, rings, pendants, bracelets and anklets instead of what is showing up in the results.

Était-ce utile?

La solution

You are seeing these facet results because of the fieldType for your productTaxonomyName field. The fieldType=text_en settting is applying filtering, stemming, tokenization, etc. to the current field. You should store facet data with a fieldType=string in addition to the one you are currently using and then facet against this new field.

<field name="productTaxonomyName" type="text_en" indexed="true" stored="true" multiValued="false" />
<field name="productTaxonomyName_facet" type="string" indexed="true" stored="false" multiValued="false" />

Then you can use a copyField directive to populate the new field:

 <copyField src="productTaxonomyName" dest="productTaxonomyName_facet" />

Update your query to the following:

select?q=gold&rows=0&wt=json&indent=true&facet=true
  &facet.query=gold&facet.field=productTaxonomyName_facet

For more details on this see the Facet Indexing section of Solr Faceting Overview.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top