Apache Lucene open-source search software
SOLR-12035: edimax should include charfilters in nostopanalyzer
Tomas Fernandez Lobbe3e29c7dbd507
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txtindex 3039ce30750..fcf1f9c69fd 100644--- a/solr/CHANGES.txt+++ b/solr/CHANGES.txt@@ -83,6 +83,9 @@ Bug Fixes* SOLR-11551: Standardize CoreAdmin API success/failure status codes (Jason Gerlowski, Steve Rowe)+* SOLR-12035: ExtendedDismaxQParser fails to include charfilters in nostopanalyzer (Tim Allison via+ Tomás Fernández Löbbe)+Optimizations----------------------diff --git a/solr/core/src/java/org/apache/solr/search/ExtendedDismaxQParser.java b/solr/core/src/java/org/apache/solr/search/ExtendedDismaxQParser.javaindex 004d1c042af..9d6cd593514 100644--- a/solr/core/src/java/org/apache/solr/search/ExtendedDismaxQParser.java+++ b/solr/core/src/java/org/apache/solr/search/ExtendedDismaxQParser.java@@ -1412,7 +1412,7 @@ public class ExtendedDismaxQParser extends QParser {newtf[j++] = facs[i];}- TokenizerChain newa = new TokenizerChain(tcq.getTokenizerFactory(), newtf);+ TokenizerChain newa = new TokenizerChain(tcq.getCharFilterFactories(), tcq.getTokenizerFactory(), newtf);newa.setPositionIncrementGap(tcq.getPositionIncrementGap(fieldName));return newa;}diff --git a/solr/core/src/test-files/solr/collection1/conf/schema12.xml b/solr/core/src/test-files/solr/collection1/conf/schema12.xmlindex 97b6ed0df81..de1b9980974 100644--- a/solr/core/src/test-files/solr/collection1/conf/schema12.xml+++ b/solr/core/src/test-files/solr/collection1/conf/schema12.xml@@ -272,6 +272,17 @@<tokenizer class="solr.StandardTokenizerFactory"/></analyzer></fieldType>+ <fieldType name="isocharfilter" class="solr.TextField">+ <analyzer type="index">+ <charFilter class="solr.MappingCharFilterFactory" mapping="mapping-ISOLatin1Accent.txt"/>+ <tokenizer class="solr.MockTokenizerFactory"/>+ </analyzer>+ <analyzer type="query">+ <charFilter class="solr.MappingCharFilterFactory" mapping="mapping-ISOLatin1Accent.txt"/>+ <tokenizer class="solr.MockTokenizerFactory"/>+ <filter class="solr.StopFilterFactory" ignoreCase="true"/>+ </analyzer>+ </fieldType><fieldType name="HTMLwhitetok" class="solr.TextField"><analyzer><charFilter class="solr.HTMLStripCharFilterFactory"/>@@ -590,6 +601,7 @@<field name="lettertok" type="lettertok" indexed="true" stored="true"/><field name="whitetok" type="whitetok" indexed="true" stored="true"/><field name="HTMLwhitetok" type="HTMLwhitetok" indexed="true" stored="true"/>+ <field name="isocharfilter" type="isocharfilter" indexed="true" stored="true"/><field name="standardtokfilt" type="standardtokfilt" indexed="true" stored="true"/><field name="standardfilt" type="standardfilt" indexed="true" stored="true"/><field name="lowerfilt" type="lowerfilt" indexed="true" stored="true"/>diff --git a/solr/core/src/test/org/apache/solr/search/TestExtendedDismaxParser.java b/solr/core/src/test/org/apache/solr/search/TestExtendedDismaxParser.javaindex 21d47db268c..f77baaf6ee1 100644--- a/solr/core/src/test/org/apache/solr/search/TestExtendedDismaxParser.java+++ b/solr/core/src/test/org/apache/solr/search/TestExtendedDismaxParser.java@@ -96,6 +96,7 @@ public class TestExtendedDismaxParser extends SolrTestCaseJ4 {assertU(adoc("id", "71", "text_sw", "ties"));assertU(adoc("id", "72", "text_sw", "wifi ATM"));assertU(adoc("id", "73", "shingle23", "A B X D E"));+ assertU(adoc("id", "74", "isocharfilter", "niño"));// assertU(adoc("id", "74", "text_pick_best", "tabby"));// assertU(adoc("id", "74", "text_as_distinct", "persian"));@@ -210,7 +211,23 @@ public class TestExtendedDismaxParser extends SolrTestCaseJ4 {, "*[count(//doc)=1]");}}-++ public void testCharFilter() throws Exception {+ // test that charfilter was applied by the indexer+ assertQ(req("defType", "edismax",+ "stopwords","false",+ "qf", "isocharfilter",+ "q","nino"), "*[count(//doc)=1]"+ );++ // test that charfilter was applied to the query+ assertQ(req("defType", "edismax",+ "stopwords","false",+ "qf", "isocharfilter",+ "q","niño"), "*[count(//doc)=1]"+ );+ }+// test the edismax query parser based on the dismax parserpublic void testFocusQueryParser() {String allq = "id:[42 TO 51]";