mirror of https://github.com/apache/lucene.git
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:
parent
f14428eef4
commit
b54f22aaab
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue