From 404bc21da980c81ed8ceb0b46286152e17b20683 Mon Sep 17 00:00:00 2001 From: orbiter Date: Mon, 2 Mar 2009 08:48:27 +0000 Subject: [PATCH] simplification of (internal) query process / refactoring git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@5662 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- htroot/yacy/search.java | 3 ++- .../anomic/plasma/plasmaSearchRankingProcess.java | 2 +- source/de/anomic/plasma/plasmaWordIndex.java | 13 ++++++++----- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/htroot/yacy/search.java b/htroot/yacy/search.java index c1c498474..e7756cf73 100644 --- a/htroot/yacy/search.java +++ b/htroot/yacy/search.java @@ -185,7 +185,8 @@ public final class search { yacyCore.log.logInfo("INIT HASH SEARCH (abstracts only): " + plasmaSearchQuery.anonymizedQueryHashes(theQuery.queryHashes) + " - " + theQuery.displayResults() + " links"); final long timer = System.currentTimeMillis(); - final Map[] containers = sb.webIndex.localSearchContainers(theQuery, plasmaSearchQuery.hashes2Set(urls)); + final Map[] containers = sb.webIndex.localSearchContainers(theQuery.queryHashes, theQuery.excludeHashes, plasmaSearchQuery.hashes2Set(urls)); + serverProfiling.update("SEARCH", new plasmaProfiling.searchEvent(theQuery.id(true), plasmaSearchEvent.COLLECTION, containers[0].size(), System.currentTimeMillis() - timer)); if (containers != null) { final Iterator> ci = containers[0].entrySet().iterator(); diff --git a/source/de/anomic/plasma/plasmaSearchRankingProcess.java b/source/de/anomic/plasma/plasmaSearchRankingProcess.java index 7a7852409..34c06ff71 100644 --- a/source/de/anomic/plasma/plasmaSearchRankingProcess.java +++ b/source/de/anomic/plasma/plasmaSearchRankingProcess.java @@ -109,7 +109,7 @@ public final class plasmaSearchRankingProcess { public void execQuery() { long timer = System.currentTimeMillis(); - this.localSearchContainerMaps = wordIndex.localSearchContainers(query, null); + this.localSearchContainerMaps = wordIndex.localSearchContainers(query.queryHashes, query.excludeHashes, null); serverProfiling.update("SEARCH", new plasmaProfiling.searchEvent(query.id(true), plasmaSearchEvent.COLLECTION, this.localSearchContainerMaps[0].size(), System.currentTimeMillis() - timer)); // join and exclude the local result diff --git a/source/de/anomic/plasma/plasmaWordIndex.java b/source/de/anomic/plasma/plasmaWordIndex.java index 642321522..ec1196c4f 100644 --- a/source/de/anomic/plasma/plasmaWordIndex.java +++ b/source/de/anomic/plasma/plasmaWordIndex.java @@ -663,17 +663,20 @@ public final class plasmaWordIndex implements ReverseIndex { } @SuppressWarnings("unchecked") - public HashMap[] localSearchContainers(final plasmaSearchQuery query, final Set urlselection) { + public HashMap[] localSearchContainers( + final TreeSet queryHashes, + final TreeSet excludeHashes, + final Set urlselection) { // search for the set of hashes and return a map of of wordhash:indexContainer containing the seach result // retrieve entities that belong to the hashes - HashMap inclusionContainers = (query.queryHashes.size() == 0) ? new HashMap(0) : getContainers( - query.queryHashes, + HashMap inclusionContainers = (queryHashes.size() == 0) ? new HashMap(0) : getContainers( + queryHashes, urlselection, true); - if ((inclusionContainers.size() != 0) && (inclusionContainers.size() < query.queryHashes.size())) inclusionContainers = new HashMap(0); // prevent that only a subset is returned + if ((inclusionContainers.size() != 0) && (inclusionContainers.size() < queryHashes.size())) inclusionContainers = new HashMap(0); // prevent that only a subset is returned final HashMap exclusionContainers = (inclusionContainers.size() == 0) ? new HashMap(0) : getContainers( - query.excludeHashes, + excludeHashes, urlselection, true); return new HashMap[]{inclusionContainers, exclusionContainers};