Fix max word length issue (though don't know why anyone would limit long words in a more-like-this query).

Also, modified to take into account all values of a field rather than just the first one.


git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@158076 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Erik Hatcher 2005-03-18 15:03:00 +00:00
parent f14428eef4
commit b54f22aaab
1 changed files with 5 additions and 3 deletions

View File

@ -677,10 +677,12 @@ public final class MoreLikeThis {
// field does not store term vector info
if (vector == null) {
Document d=ir.document(docNum);
String text=d.get(fieldName);
String text[]=d.getValues(fieldName);
if(text!=null)
{
addTermFrequencies(new StringReader(text), termFreqMap, fieldName);
for (int j = 0; j < text.length; j++) {
addTermFrequencies(new StringReader(text[j]), termFreqMap, fieldName);
}
}
}
else {
@ -765,7 +767,7 @@ public final class MoreLikeThis {
if (minWordLen > 0 && len < minWordLen) {
return true;
}
if (maxWordLen > 0 && len < maxWordLen) {
if (maxWordLen > 0 && len > maxWordLen) {
return true;
}
return false;