Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

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.

reger8af70950d901
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<TextSnippet>, Comparator<TextSnip
if (!remainingHashes.isEmpty()) {
// we did not find everything in the metadata, look further into the document itself.
-
- // first acquire the sentences:
- String solrText = row.getText();
- if (solrText != null && solrText.length() > 0) {
+
+ // first acquire the sentences (from description/abstract or text):
+ ArrayList<String> solrdesc = row.getDescription();
+ if (!solrdesc.isEmpty()) { // include description_txt (similar to solr highlighting config)
+ sentences = new ArrayList<StringBuilder>();
+ 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);