In solrconfig.xml file
Copy FIelds
<copyField source="Name" dest="NameKeywords"/>
<copyField source="Keywords" dest="NameKeywords"/>
New Field
<field name="NameKeywords" type="NameKeywordFieldType" indexed="true" stored="true" multiValued="true"/>
Custom Field Type
<fieldType name="NameKeywordFieldType" class="solr.TextField" positionIncrementGap="100">
<analyzer type="index">
<tokenizer class="solr.KeywordTokenizerFactory"/>
<filter class="solr.StopFilterFactory" words="stopwords.txt" ignoreCase="true"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.EnglishPossessiveFilterFactory"/>
<filter class="solr.HyphenatedWordsFilterFactory"/>
</analyzer>
<analyzer type="query">
<tokenizer class="solr.KeywordTokenizerFactory"/>
<filter class="solr.StopFilterFactory" words="stopwords.txt" ignoreCase="true"/>
<filter class="solr.SynonymGraphFilterFactory" expand="true" ignoreCase="true" synonyms="synonyms.txt"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.EnglishPossessiveFilterFactory"/>
<filter class="solr.HyphenatedWordsFilterFactory"/>
</analyzer>
</fieldType>
So, when I searched anything with the NameKeywords field, nothing is working (empty array returned)
Result of search with NameKeywords
{
"responseHeader":{
"status":0,
"QTime":1,
"params":{
"q":"NameKeywords:black",
"_":"1582270957982"}},
"response":{"numFound":0,"start":0,"docs":[]
}}
But when I searched with the Name field, All working fine.
Result of search with Name
{
"responseHeader":{
"status":0,
"QTime":0,
"params":{
"q":"Name:black",
"fl":"Name",
"rows":"2",
"_":"1582270957982"}},
"response":{"numFound":32560,"start":0,"docs":[
{
"Name":"40037 Black And Stripe Top, Black & Stripe / 10"},
{
"Name":"40037 Black And Stripe Top, Black & Stripe / 12"}]
}}
So what is missing with the NameKeywords field?