mirror of https://github.com/apache/lucene.git
SOLR-521: StopFilterFactory support for enablePositionIncrements
git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@648433 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
edfcaa6161
commit
7bcf99813d
|
@ -247,6 +247,9 @@ New Features
|
|||
BinaryResponseParser for utilizing the binary format via SolrJ.
|
||||
(Noble Paul, yonik)
|
||||
|
||||
45. SOLR-521: StopFilterFactory support for "enablePositionIncrements"
|
||||
(Walter Ferrara via hossman)
|
||||
|
||||
Changes in runtime behavior
|
||||
|
||||
Optimizations
|
||||
|
|
|
@ -164,7 +164,15 @@
|
|||
<!-- in this example, we will only use synonyms at query time
|
||||
<filter class="solr.SynonymFilterFactory" synonyms="index_synonyms.txt" ignoreCase="true" expand="false"/>
|
||||
-->
|
||||
<filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt"/>
|
||||
<!-- Case insensitive stop word removal.
|
||||
enablePositionIncrements=true ensures that a 'gap' is left to
|
||||
allow for accurate phrase queries.
|
||||
-->
|
||||
<filter class="solr.StopFilterFactory"
|
||||
ignoreCase="true"
|
||||
words="stopwords.txt"
|
||||
enablePositionIncrements="true"
|
||||
/>
|
||||
<filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="1" catenateNumbers="1" catenateAll="0" splitOnCaseChange="1"/>
|
||||
<filter class="solr.LowerCaseFilterFactory"/>
|
||||
<filter class="solr.EnglishPorterFilterFactory" protected="protwords.txt"/>
|
||||
|
|
|
@ -35,6 +35,7 @@ public class StopFilterFactory extends BaseTokenFilterFactory implements Resourc
|
|||
public void inform(ResourceLoader loader) {
|
||||
String stopWordFile = args.get("words");
|
||||
ignoreCase = getBoolean("ignoreCase",false);
|
||||
enablePositionIncrements = getBoolean("enablePositionIncrements",false);
|
||||
|
||||
if (stopWordFile != null) {
|
||||
try {
|
||||
|
@ -50,8 +51,11 @@ public class StopFilterFactory extends BaseTokenFilterFactory implements Resourc
|
|||
|
||||
private Set stopWords;
|
||||
private boolean ignoreCase;
|
||||
private boolean enablePositionIncrements;
|
||||
|
||||
public StopFilter create(TokenStream input) {
|
||||
return new StopFilter(input,stopWords,ignoreCase);
|
||||
StopFilter stopFilter = new StopFilter(input,stopWords,ignoreCase);
|
||||
stopFilter.setEnablePositionIncrements(enablePositionIncrements);
|
||||
return stopFilter;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue