LUCENE-8121: Fix span terms frequency to return the freq of the entire spans (not the frequency of the term within the span).

This commit is contained in:
Jim Ferenczi 2018-01-11 12:45:20 +01:00
parent 75d50b4492
commit fd7aea5bed
2 changed files with 3 additions and 3 deletions

View File

@ -400,7 +400,7 @@ public class PhraseHelper {
@Override @Override
public int freq() throws IOException { public int freq() throws IOException {
return startOffsets.length; return numPairs;
} }
@Override @Override

View File

@ -163,7 +163,7 @@ public class TestUnifiedHighlighterStrictPhrases extends LuceneTestCase {
return Arrays.toString(passages); return Arrays.toString(passages);
} }
}); });
assertArrayEquals(new String[]{"[Passage[0-22]{yin[0-3],yang[4-8],yin[10-13]}score=2.0685003]"}, assertArrayEquals(new String[]{"[Passage[0-22]{yin[0-3],yang[4-8],yin[10-13]}score=2.4964213]"},
highlighter.highlight("body", query, topDocs)); highlighter.highlight("body", query, topDocs));
} }
@ -207,7 +207,7 @@ public class TestUnifiedHighlighterStrictPhrases extends LuceneTestCase {
return Arrays.toString(passages); return Arrays.toString(passages);
} }
}); });
assertArrayEquals(new String[]{"[Passage[0-41]{alpha[0-5],bravo[6-11],charlie[12-19]}score=2.723861]"}, assertArrayEquals(new String[]{"[Passage[0-41]{alpha[0-5],bravo[6-11],charlie[12-19]}score=3.931102]"},
highlighter.highlight("body", query, topDocs)); highlighter.highlight("body", query, topDocs));
} }