From 8af70950d901fe8f7436312f4c60a3e00b301677 Mon Sep 17 00:00:00 2001 From: reger Date: Thu, 5 Mar 2015 02:22:05 +0100 Subject: [PATCH] harmonize snippet computation to considere description_txt always (solr hl & internal). For now just added desc to text list for computation, could be further equalized with hl computation. --- source/net/yacy/search/snippet/TextSnippet.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/source/net/yacy/search/snippet/TextSnippet.java b/source/net/yacy/search/snippet/TextSnippet.java index fb19b266d..d864d7c21 100644 --- a/source/net/yacy/search/snippet/TextSnippet.java +++ b/source/net/yacy/search/snippet/TextSnippet.java @@ -187,12 +187,17 @@ public class TextSnippet implements Comparable, Comparator 0) { + + // first acquire the sentences (from description/abstract or text): + ArrayList solrdesc = row.getDescription(); + if (!solrdesc.isEmpty()) { // include description_txt (similar to solr highlighting config) + sentences = new ArrayList(); + for (String s:solrdesc) sentences.add(new StringBuilder(s)); + } + final String solrText = row.getText(); + if (solrText != null && solrText.length() > 0) { // TODO: instead of join with desc, we could check if snippet already complete and skip further computation // compute sentences from solr query - sentences = row.getSentences(pre); + if (sentences == null) sentences = row.getSentences(pre); else sentences.addAll(row.getSentences(pre)); } else if (net.yacy.crawler.data.Cache.has(url.hash())) { // get the sentences from the cache final Request request = loader == null ? null : loader.request(url, true, reindexing);