Disable facet line fields in solr

I am using solr 3.5 and have added a custom field that adds a category to the document by defining the following in schema.xml.

<field name="category" type="string" indexed="true" stored="true"/> 

Now I implement Search-Web-Client, which should display all the index values ​​of this field. I did this with the following query:

 facet=true&facet.field=category&q=* 

The results look like this:

 <response> <lst name="responseHeader"> <int name="status">0</int> <int name="QTime">45</int> <lst name="params"> <str name="facet.field">category</str> <str name="q">*</str> <str name="facet">true</str> </lst> </lst> <result name="response" numFound="0" start="0" maxScore="0.0"/> <lst name="facet_counts"> <lst name="facet_queries"/> <lst name="facet_fields"> <lst name="category"> <int name="category1">0</int> <int name="category2">0</int> <int name="category3">0</int> <int name="category4">0</int> <int name="category5">0</int> </lst> </lst> <lst name="facet_dates"/> <lst name="facet_ranges"/> </lst> </response> 

My web client displays all category names, but they are written in lower case, but are stored in the index with a capital letter.

 <response> <result> <doc> ... <str name="category">Category1</str> ... </doc> </result> </response> 
  • Solution a: is it possible for facet value names to be case sensitive?
  • Solution b: Is there another query that will give each category value stored in the index?
+4
source share
1 answer

I suspect you are using LowerCaseFilterFactory for your field of type string . In this case, the indexed values ​​are category1 , but the stored value is still the original that you sent, category1 .

You should simply remove the LowerCaseFilterFactory from the fieldType string definition in schema.xml to have the desired facet behavior.

Actually, a special copyField instance is usually used for a facet with a simple fieldType type, without Tokenizer , Filter , etc.

+11
source

Source: https://habr.com/ru/post/1391282/


All Articles