lucene-addons
lucene-addons copied to clipboard
Prefix query is not getting analysed.
Hi Tim,
With current Lucene-addon when I try to search fl:"Sto* books" with following analysis chain I see the prefix query not changing to sto* as expected.
Analysis chain.
<tokenizer class="solr.WhitespaceTokenizerFactory"/> <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt"/> <filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="1" catenateNumbers="1" catenateAll="1" splitOnCaseChange="1" preserveOriginal="1"/> <filter
class="solr.ICUFoldingFilterFactory"/>`
During debugging I found the normalise method of Analyzer class is not calling the classes of above analysis chain.
Can you please help?
Best, Modassar
Hi Tim,
Can you please provide your suggestion? It is getting a blocker and I am not able to migrate to newer Solr version. Kindly look into it.
Best, Modassar
Hi Tim,
I tried to understand the logic of lucene-5205 and noticed that the normalize() method is not using the analysis chain. When I looked into older lucene-5205 I found that it uses following code for prefix queries.
protected Query newPrefixQuery(String fieldName, String termText) throws ParseException {
Analyzer mtAnalyzer = getMultiTermAnalyzer(fieldName);
if (mtAnalyzer == null) {
return handleNullAnalyzerPrefix(fieldName, termText);
}
BytesRef analyzed = analyzeMultitermTermParseEx(mtAnalyzer, fieldName, termText);
return wrapMultiTermRewrite(new PrefixQuery(new Term(fieldName, analyzed)));
}
So I tried to use the older lucene-5205 code with Solr-8.6.3 and found that it is very slow for a query which used to work very efficiently with Solr-6.5.1. The other queries are fine. I understand this can be due to some differences in Solr-6.5.1 and Solr-8.6.3. Please correct me if I am wrong.
Kindly help.
Best, Modassar