diff --git a/CHANGES.txt b/CHANGES.txt index c4247c0ade1..c8eff2ed87c 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -449,6 +449,9 @@ Bug Fixes SolrQueryParser considers special. (hossman) +54. SOLR-1317: Fix CapitalizationFilterFactory to work when keep parameter is not specified. + (ehatcher) + Other Changes ---------------------- 1. Upgraded to Lucene 2.4.0 (yonik) diff --git a/src/java/org/apache/solr/analysis/CapitalizationFilterFactory.java b/src/java/org/apache/solr/analysis/CapitalizationFilterFactory.java index db6377f923c..96dcf46df71 100644 --- a/src/java/org/apache/solr/analysis/CapitalizationFilterFactory.java +++ b/src/java/org/apache/solr/analysis/CapitalizationFilterFactory.java @@ -141,7 +141,7 @@ public class CapitalizationFilterFactory extends BaseTokenFilterFactory { return; } - if (keep.contains(buffer, offset, length)) { + if (keep != null && keep.contains(buffer, offset, length)) { if (wordCount == 0 && forceFirstLetter) { buffer[offset] = Character.toUpperCase(buffer[offset]); } diff --git a/src/test/org/apache/solr/analysis/TestCapitalizationFilter.java b/src/test/org/apache/solr/analysis/TestCapitalizationFilter.java index 7e13787a5f0..a2798a7332d 100644 --- a/src/test/org/apache/solr/analysis/TestCapitalizationFilter.java +++ b/src/test/org/apache/solr/analysis/TestCapitalizationFilter.java @@ -17,6 +17,8 @@ package org.apache.solr.analysis; +import junit.framework.TestCase; + import java.util.HashMap; import java.util.Map; @@ -115,5 +117,10 @@ public class TestCapitalizationFilter extends BaseTokenTestCase { termBuffer = "kiTTEN".toCharArray(); factory.processWord(termBuffer, 0, termBuffer.length, 0 ); assertEquals( "kiTTEN", new String(termBuffer, 0, termBuffer.length)); + + factory.keep = null; + termBuffer = "kiTTEN".toCharArray(); + factory.processWord(termBuffer, 0, termBuffer.length, 0 ); + assertEquals( "Kitten", new String(termBuffer, 0, termBuffer.length)); } }