[TESTS] Fix test to use index-level doc IDs instead of segment-level doc IDs.

This commit is contained in:
Adrien Grand 2014-05-23 01:20:41 +02:00
parent 0d3410a837
commit 14420d7c4e
1 changed files with 3 additions and 2 deletions

View File

@ -40,13 +40,14 @@ public class CustomHighlighter implements Highlighter {
public HighlightField highlight(HighlighterContext highlighterContext) {
SearchContextHighlight.Field field = highlighterContext.field;
CacheEntry cacheEntry = (CacheEntry) highlighterContext.hitContext.cache().get("test-custom");
final int docId = highlighterContext.hitContext.readerContext().docBase + highlighterContext.hitContext.docId();
if (cacheEntry == null) {
cacheEntry = new CacheEntry();
highlighterContext.hitContext.cache().put("test-custom", cacheEntry);
cacheEntry.docId = highlighterContext.hitContext.docId();
cacheEntry.docId = docId;
cacheEntry.position = 1;
} else {
if (cacheEntry.docId == highlighterContext.hitContext.docId()) {
if (cacheEntry.docId == docId) {
cacheEntry.position++;
} else {
cacheEntry.docId = highlighterContext.hitContext.docId();