SOLR-1342: CapitalizationFilterFactory uses incorrect term length calculations.

git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@801845 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Mark Robert Miller 2009-08-06 23:54:49 +00:00
parent ce84cfc655
commit 1b2549e92f
2 changed files with 7 additions and 3 deletions

View File

@ -456,6 +456,10 @@ Bug Fixes
54. SOLR-1317: Fix CapitalizationFilterFactory to work when keep parameter is not specified.
(ehatcher)
55. SOLR-1342: CapitalizationFilterFactory uses incorrect term length calculations.
(Robert Muir via Mark Miller)
Other Changes
----------------------
1. Upgraded to Lucene 2.4.0 (yonik)

View File

@ -209,7 +209,7 @@ class CapitalizationFilter extends TokenFilter {
//make a backup in case we exceed the word count
System.arraycopy(termBuffer, 0, backup, 0, termBufferLength);
}
if (termBuffer.length < factory.maxTokenLength) {
if (termBufferLength < factory.maxTokenLength) {
int wordCount = 0;
int lastWordStart = 0;
@ -226,8 +226,8 @@ class CapitalizationFilter extends TokenFilter {
}
// process the last word
if (lastWordStart < termBuffer.length) {
factory.processWord(termBuffer, lastWordStart, termBuffer.length - lastWordStart, wordCount++);
if (lastWordStart < termBufferLength) {
factory.processWord(termBuffer, lastWordStart, termBufferLength - lastWordStart, wordCount++);
}
if (wordCount > factory.maxWordCount) {