SOLR-12035: edimax should include charfilters in nostopanalyzer

This closes #329
This commit is contained in:
Tomas Fernandez Lobbe 2018-03-27 21:37:19 -07:00
parent f8af274783
commit 3e29c7dbd5
4 changed files with 34 additions and 2 deletions

View File

@ -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
----------------------

View File

@ -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;
}

View File

@ -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"/>

View File

@ -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 parser
public void testFocusQueryParser() {
String allq = "id:[42 TO 51]";