I have solr schema with field categoryName
as string
which has hierarchical data as follows
Fruits & Vegetables/Fruits
Fruits & Vegetables/Vegetables
categoryName
field has following fieldType
<fieldType name="text_general" class="solr.TextField" positionIncrementGap="100">
<analyzer type="index">
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" />
<!-- in this example, we will only use synonyms at query time
<filter class="solr.SynonymFilterFactory" synonyms="index_synonyms.txt" ignoreCase="true" expand="false"/>
-->
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
<analyzer type="query">
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" />
<filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
</fieldType>
When I want to search only Vegetables here is my query
/query?q=categoryName:Vegetables
This gives me all the categories including Fruits
/query?q=(categoryName:/Vegetables/)
This gives me all the categories including Fruits
and following is the debug
"rawquerystring": "(categoryName:/Vegetables/)",
"querystring": "(categoryName:/Vegetables/)",
"parsedquery": "RegexpQuery(categoryName:/vegetables/)",
"parsedquery_toString": "categoryName:/vegetables/"
/query?q=categoryName:/\/Vegetables/
This gives me all the categories including Fruits
and following is the debug
"rawquerystring": "(categoryName:/\\/Vegetables/)",
"querystring": "(categoryName:/\\/Vegetables/)",
"parsedquery": "RegexpQuery(categoryName:/\\/vegetables/)",
"parsedquery_toString": "categoryName:/\\/vegetables/"
/query?q=(categoryName:/Vegetables$/)
This gives me zero results and following is the debug
"rawquerystring": "(categoryName:/*Vegetables$/)",
"querystring": "(categoryName:/*Vegetables$/)",
"parsedquery": "RegexpQuery(categoryName:/*vegetables$/)",
"parsedquery_toString": "categoryName:/*vegetables$/"
What is the correct way to get exclusive documents of type Vegetables? Or Fruits