I am trying to index a sample JSON document in my Solr core which is as follows
[
{
"ID": "1",
"title": "Cooking Recommendations",
"tags": ["cooking", "meetup"],
"posts": [{
"ID": "2",
"title": "Cookies",
"comments": [{
"ID": "3",
"content": "Lovely recipe"
},
{
"ID": "4",
"content": "A-"
}
]
},
{
"ID": "5",
"title": "Cakes"
}
]
},
{
"ID": "6",
"title": "For Hire",
"tags": ["professional", "jobs"],
"posts": [{
"ID": "7",
"title": "Search Engineer",
"comments": [{
"ID": "8",
"content": "I am interested"
},
{
"ID": "9",
"content": "How large is the team?"
}
]
},
{
"ID": "10",
"title": "Low level Engineer"
}
]
}
]
Now, I have updated my managed-schema.xml file to enable the _text_ catch-all field as I would want to make free-text queries without specifying the key against which the query string should be run.
This is how my schema looks
<field name="_root_" type="text_general" indexed="false" stored="true" docValues="false" />
<field name="_nest_path_" type="_nest_path_" />
<fieldType name="_nest_path_" class="solr.NestPathField" />
<field name="_text_" type="text_general" indexed="true" stored="true" multiValued="true"/>
<copyField source="*" dest="_text_"/>
The corresponding analyzer
<fieldType name="_text_" class="solr.TextField" positionIncrementGap="100">
<analyzer type="index">
<tokenizer class="solr.WhitespaceTokenizerFactory" />
<filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="1" catenateNumbers="1" catenateAll="0" splitOnCaseChange="1" preserveOriginal="1" />
<filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" enablePositionIncrements="true" />
<filter class="solr.LowerCaseFilterFactory" />
<filter class="solr.SnowballPorterFilterFactory" language="German" />
<filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
</analyzer>
<analyzer type="query">
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
<filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="1" catenateNumbers="1" catenateAll="0" splitOnCaseChange="1" preserveOriginal="1" />
<filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" enablePositionIncrements="true" />
<filter class="solr.LowerCaseFilterFactory" />
<filter class="solr.SnowballPorterFilterFactory" language="German" />
<filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
</analyzer>
</fieldType>
With this config, the JSON documents gets indexed fine and I am able to run a query like title:"Cooking Recommendations" to retrieve the first JSON object alone. However, I am trying to run a free-text query without specifying the key title and just pass the query string to fetch the same results. I looked into the Solr documentation and see that I can achieve this with CopyField directive, however, if I just pass the string "Cooking Recommendations", I get no results.
I did see the core's schema and see that _text_ field is available. Not sure what I am missing here. Can someone guide me?
EDIT:
I am performing my queries using the Solr query UI which is as follows:
I am using /select as the request handler, passing the df as _text_. Still, it doesn't return the results I expect.
EDIT 2:
I tried using the Analysis tab as suggested below and see that it works fine there.

