From f8ac694e5183d69689961b4d464a5b0f538f66f2 Mon Sep 17 00:00:00 2001 From: low012 Date: Sat, 30 Sep 2006 00:27:42 +0000 Subject: [PATCH] *) 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) git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@2677 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- .../de/anomic/plasma/plasmaSnippetCache.java | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) 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; mc@anomic.de // 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] = "" + w[j] + ""; + w[j] = w[j] + mark; } } StringBuffer l = new StringBuffer(line.length() + queryHashes.size() * 8);