From 7bcf99813dbc37b7aabcbfe1de334657a3b93de4 Mon Sep 17 00:00:00 2001 From: "Chris M. Hostetter" Date: Tue, 15 Apr 2008 22:19:18 +0000 Subject: [PATCH] SOLR-521: StopFilterFactory support for enablePositionIncrements git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@648433 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 3 +++ example/solr/conf/schema.xml | 10 +++++++++- .../org/apache/solr/analysis/StopFilterFactory.java | 6 +++++- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index acf4be16708..ec71e87cc71 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -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 diff --git a/example/solr/conf/schema.xml b/example/solr/conf/schema.xml index 08933373fa3..6356aea9fed 100755 --- a/example/solr/conf/schema.xml +++ b/example/solr/conf/schema.xml @@ -164,7 +164,15 @@ - + + diff --git a/src/java/org/apache/solr/analysis/StopFilterFactory.java b/src/java/org/apache/solr/analysis/StopFilterFactory.java index e4a46d544f2..e939807fb07 100644 --- a/src/java/org/apache/solr/analysis/StopFilterFactory.java +++ b/src/java/org/apache/solr/analysis/StopFilterFactory.java @@ -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; } }