I am having problem with solr wildcard search and stopwords. I have added few stopwords "to", "for" ,"is" in stopwords.txt . When i am not doing a wildcard search , its working perfectly.
Query --> q=learningObjectTopic:to&rows=1
<response>
<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">3</int>
<lst name="params">
<str name="q">learningObjectTopic:to</str>
<str name="rows">1</str>
</lst>
</lst>
<result name="response" numFound="0" start="0"/>
</response>
When i do a wildcard search its returning data .
Query --> q=learningObjectTopic:*to*&rows=1
<response>
<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">5</int>
<lst name="params">
<str name="q">learningObjectTopic:*to*</str>
<str name="rows">1</str>
</lst>
</lst>
<result name="response" numFound="75" start="0">
<doc>
<str name="id">56f4bc54b2de79277297dcab</str>
<str name="learningObjectId">LO1_SK1_18</str>
<str name="learningObjectTopic">Introduction to Web Development</str>
<str name="category">learningObject</str>
<long name="_version_">1537824533459763200</long>
</doc>
</result>
</response>
This is my analyzer
<fieldType name="text_general" class="solr.TextField" multiValued="false" positionIncrementGap="100">
<analyzer type="index">
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
<filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" />
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
What i require is , "to" should not match in the wildcard query too. What am i missing here ?
Note : learningObjectTopic:to search skipped "to" words in results when i added "to" in stopwords , so stopword indexing is working .
Solr StopFilterFactory is not a multi term aware component and hence stopFilterFactory will not work on for wildcard queries.Reference link.
And also, the scenario may not be a valid one. since, if there is a keyword "Tokyo" in index, then the search keyword "to*" should return this result instead of showing "0" result which is not correct.