Skip to content

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

*) fixed a bug where searchword in snippets were not displayed bold in front of a punctuation mark (see http://www.yacy-forum.de/viewtopic.php?p=25998)

low012f8ac694e5183
diff --git a/source/de/anomic/plasma/plasmaSnippetCache.java b/source/de/anomic/plasma/plasmaSnippetCache.java
index 6183e7be4..1aa2d5b80 100644
--- a/source/de/anomic/plasma/plasmaSnippetCache.java
+++ b/source/de/anomic/plasma/plasmaSnippetCache.java
@@ -4,7 +4,9 @@
// (C) by Michael Peter Christen; [email protected]
// first published on http://www.anomic.de
// Frankfurt, Germany, 2005
-// last major change: 07.06.2005
+// last major change: 30.09.2006
+//
+// contributions by Marc Nause [MN]
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -127,10 +129,24 @@ public class plasmaSnippetCache {
Iterator i = queryHashes.iterator();
String h;
String[] w = line.split(" ");
+ String mark = "";
while (i.hasNext()) {
h = (String) i.next();
for (int j = 0; j < w.length; j++) {
+ //ignore punctuation marks (contrib [MN])
+ if ((w[j].endsWith("."))||
+ (w[j].endsWith(","))||
+ (w[j].endsWith("!"))||
+ (w[j].endsWith("?"))) {
+ mark = w[j].substring(w[j].length()-1);
+ w[j] = w[j].substring(0,w[j].length()-1);
+ }
+ else {
+ mark = "";
+ }
+ //end contrib [MN]
if (indexEntryAttribute.word2hash(w[j]).equals(h)) w[j] = "<b>" + w[j] + "</b>";
+ w[j] = w[j] + mark;
}
}
StringBuffer l = new StringBuffer(line.length() + queryHashes.size() * 8);