mirror of
https://github.com/apache/zeppelin
synced 2026-05-24 09:38:26 +00:00
Search: merge first 3 fragments + full paragraph in search result
This commit is contained in:
parent
11127f033c
commit
9ca86289db
1 changed files with 2 additions and 2 deletions
|
|
@ -92,7 +92,7 @@ public class SearchService {
|
|||
|
||||
String text = doc.get(SEARCH_FIELD);
|
||||
TokenStream tokenStream = TokenSources.getTokenStream(searcher.getIndexReader(), id, SEARCH_FIELD, analyzer);
|
||||
TextFragment[] frag = highlighter.getBestTextFragments(tokenStream, text, false, 3);
|
||||
TextFragment[] frag = highlighter.getBestTextFragments(tokenStream, text, true, 3);
|
||||
//TODO(bzz): remove this as too verbose
|
||||
LOG.info(" {} fragments found for query '{}' in '{}'", frag.length, query, text);
|
||||
for (int j = 0; j < frag.length; j++) {
|
||||
|
|
@ -102,7 +102,7 @@ public class SearchService {
|
|||
}
|
||||
String fragment = (frag != null && frag.length > 0) ? frag[0].toString() : "";
|
||||
|
||||
matchingParagraphs.add(ImmutableMap.of("id", path, "name", title, "fragment", fragment));
|
||||
matchingParagraphs.add(ImmutableMap.of("id", path, "name", title, "fragment", fragment, "text", text));
|
||||
} else {
|
||||
LOG.info("{}. No {} for this document", i + 1, ID_FIELD);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue