From ee8b1d4de10b046734a9ea76b930645d923b0b44 Mon Sep 17 00:00:00 2001 From: orbiter Date: Thu, 24 Nov 2011 16:05:09 +0000 Subject: [PATCH] fixed unresolved pattern and unwanted local/global switch when using votes on search results git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@8093 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- htroot/index.java | 2 +- htroot/yacysearch.java | 4 ++-- .../yacy/search/query/SearchEventCache.java | 7 +++++++ .../net/yacy/search/query/SnippetProcess.java | 20 +++++++++++++++++++ 4 files changed, 30 insertions(+), 3 deletions(-) diff --git a/htroot/index.java b/htroot/index.java index e6a97ac04..400274020 100644 --- a/htroot/index.java +++ b/htroot/index.java @@ -97,8 +97,8 @@ public class index { prop.put("excluded", "0"); prop.put("combine", "0"); prop.put("resultbottomline", "0"); - prop.put("maximumRecords", maximumRecords); prop.put("searchoptions", searchoptions); + prop.put("searchoptions_maximumRecords", maximumRecords); prop.put("searchoptions_count-10", (count == 10) ? "1" : "0"); prop.put("searchoptions_count-50", (count == 50) ? "1" : "0"); prop.put("searchoptions_count-100", (count == 100) ? "1" : "0"); diff --git a/htroot/yacysearch.java b/htroot/yacysearch.java index 36347aadc..51898b970 100644 --- a/htroot/yacysearch.java +++ b/htroot/yacysearch.java @@ -503,7 +503,7 @@ public class yacysearch { } // delete the search history since this still shows the entry - SearchEventCache.cleanupEvents(true); + SearchEventCache.delete(delHash); } catch (final IOException e) { Log.logException(e); } @@ -596,7 +596,7 @@ public class yacysearch { offset, urlmask, clustersearch && global ? QueryParams.Searchdom.CLUSTER : - (global && indexReceiveGranted && !post.containsKey("deleteref") ? QueryParams.Searchdom.GLOBAL : QueryParams.Searchdom.LOCAL), + (global && indexReceiveGranted ? QueryParams.Searchdom.GLOBAL : QueryParams.Searchdom.LOCAL), 20, constraint, true, diff --git a/source/net/yacy/search/query/SearchEventCache.java b/source/net/yacy/search/query/SearchEventCache.java index 24e706c7b..92d1a4445 100644 --- a/source/net/yacy/search/query/SearchEventCache.java +++ b/source/net/yacy/search/query/SearchEventCache.java @@ -65,6 +65,13 @@ public class SearchEventCache { if (oldEvent == null) cacheInsert++; } + public static boolean delete(final String urlhash) { + for (final SearchEvent event: lastEvents.values()) { + if (event.result().delete(urlhash)) return true; + } + return false; + } + public static void cleanupEvents(boolean all) { // remove old events in the event cache if (MemoryControl.shortStatus()) all = true; diff --git a/source/net/yacy/search/query/SnippetProcess.java b/source/net/yacy/search/query/SnippetProcess.java index f130dfc26..a120403b5 100644 --- a/source/net/yacy/search/query/SnippetProcess.java +++ b/source/net/yacy/search/query/SnippetProcess.java @@ -36,6 +36,7 @@ import net.yacy.cora.document.MultiProtocolURI; import net.yacy.cora.protocol.ResponseHeader; import net.yacy.cora.ranking.ScoreMap; import net.yacy.cora.ranking.WeakPriorityBlockingQueue; +import net.yacy.cora.ranking.WeakPriorityBlockingQueue.Element; import net.yacy.cora.ranking.WeakPriorityBlockingQueue.ReverseElement; import net.yacy.cora.services.federated.solr.SolrConnector; import net.yacy.cora.services.federated.yacy.CacheStrategy; @@ -532,4 +533,23 @@ public class SnippetProcess { } // finished, no more actions possible here } + + /** + * delete a specific entry from the search results + * this is used if the user clicks on a '-' sign beside the search result + * @param urlhash + * @return true if an entry was deleted, false otherwise + */ + public boolean delete(final String urlhash) { + final Iterator> i = this.result.iterator(); + Element entry; + while (i.hasNext()) { + entry = i.next(); + if (urlhash.equals(ASCII.String(entry.getElement().url().hash()))) { + i.remove(); + return true; + } + } + return false; + } }