mirror of https://github.com/apache/lucene.git
SOLR-1317: Fix CapitalizationFilterFactory to work when keep parameter is not specified
git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@799593 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
67ad122d9b
commit
18078af958
|
@ -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)
|
||||
|
|
|
@ -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]);
|
||||
}
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue