Skip to content

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

optimized QueryGoal (reducing mem and computation by removing all_hashes) - all_hashes used for text highlighting and word distance computation which can be done with include_hashes only

reger29967102a20c
diff --git a/htroot/IndexControlRWIs_p.java b/htroot/IndexControlRWIs_p.java
index 1525dd205..b04aa5917 100644
--- a/htroot/IndexControlRWIs_p.java
+++ b/htroot/IndexControlRWIs_p.java
@@ -609,7 +609,7 @@ public class IndexControlRWIs_p {
final Bitfield filter) {
final HandleSet queryhashes = QueryParams.hashes2Set(ASCII.String(keyhash));
- final QueryGoal qg = new QueryGoal(queryhashes, null, queryhashes);
+ final QueryGoal qg = new QueryGoal(queryhashes, null);
final QueryParams query = new QueryParams(
qg,
new QueryModifier(),
diff --git a/htroot/yacy/search.java b/htroot/yacy/search.java
index 614597e94..456b4a898 100644
--- a/htroot/yacy/search.java
+++ b/htroot/yacy/search.java
@@ -222,7 +222,7 @@ public final class search {
if (query.isEmpty() && abstractSet != null) {
// this is _not_ a normal search, only a request for index abstracts
final Segment indexSegment = sb.index;
- QueryGoal qg = new QueryGoal(abstractSet, new RowHandleSet(WordReferenceRow.urlEntryRow.primaryKeyLength, WordReferenceRow.urlEntryRow.objectOrder, 0), abstractSet);
+ QueryGoal qg = new QueryGoal(abstractSet, new RowHandleSet(WordReferenceRow.urlEntryRow.primaryKeyLength, WordReferenceRow.urlEntryRow.objectOrder, 0));
theQuery = new QueryParams(
qg,
modifier,
@@ -286,7 +286,7 @@ public final class search {
RowHandleSet allHashes = new RowHandleSet(WordReferenceRow.urlEntryRow.primaryKeyLength, WordReferenceRow.urlEntryRow.objectOrder, 0);
try {allHashes.putAll(queryhashes);} catch (final SpaceExceededException e) {}
try {allHashes.putAll(excludehashes);} catch (final SpaceExceededException e) {}
- QueryGoal qg = new QueryGoal(queryhashes, excludehashes, allHashes);
+ QueryGoal qg = new QueryGoal(queryhashes, excludehashes);
theQuery = new QueryParams(
qg,
modifier,
diff --git a/htroot/yacysearch.java b/htroot/yacysearch.java
index 421def0f0..80e55f630 100644
--- a/htroot/yacysearch.java
+++ b/htroot/yacysearch.java
@@ -524,7 +524,7 @@ public class yacysearch {
// the query
final QueryGoal qg = new QueryGoal(originalquerystring, querystring.trim());
- final int maxDistance = (querystring.indexOf('"', 0) >= 0) ? qg.getAllHashes().size() - 1 : Integer.MAX_VALUE;
+ final int maxDistance = (querystring.indexOf('"', 0) >= 0) ? qg.getIncludeHashes().size() - 1 : Integer.MAX_VALUE;
// filter out stopwords
final SortedSet<String> filtered = SetTools.joinConstructiveByTest(qg.getIncludeStrings(), Switchboard.stopwords); //find matching stopwords
diff --git a/source/net/yacy/search/query/QueryGoal.java b/source/net/yacy/search/query/QueryGoal.java
index 544efe6a7..4a72f110e 100644
--- a/source/net/yacy/search/query/QueryGoal.java
+++ b/source/net/yacy/search/query/QueryGoal.java
@@ -49,12 +49,12 @@ public class QueryGoal {
private static String seps = ".,/&_";
private String query_original;
- private HandleSet include_hashes, exclude_hashes, all_hashes;
+ private HandleSet include_hashes, exclude_hashes;
private final ArrayList<String> include_words, exclude_words, all_words;
private final ArrayList<String> include_strings, exclude_strings, all_strings;
- public QueryGoal(HandleSet include_hashes, HandleSet exclude_hashes, HandleSet all_hashes) {
+ public QueryGoal(HandleSet include_hashes, HandleSet exclude_hashes) {
this.query_original = null;
this.include_words = new ArrayList<String>();
this.exclude_words = new ArrayList<String>();
@@ -64,7 +64,6 @@ public class QueryGoal {
this.all_strings = new ArrayList<String>();
this.include_hashes = include_hashes;
this.exclude_hashes = exclude_hashes;
- this.all_hashes = all_hashes;
}
public QueryGoal(String query_original, String query_words) {
@@ -99,7 +98,6 @@ public class QueryGoal {
this.include_hashes = null;
this.exclude_hashes = null;
- this.all_hashes = null;
}
@@ -172,12 +170,7 @@ public class QueryGoal {
if (exclude_hashes == null) exclude_hashes = Word.words2hashesHandles(exclude_words);
return exclude_hashes;
}
-
- public HandleSet getAllHashes() {
- if (all_hashes == null) all_hashes = Word.words2hashesHandles(all_words);
- return all_hashes;
- }
-
+
public ArrayList<String> getIncludeStrings() {
return include_strings;
}
diff --git a/source/net/yacy/search/snippet/TextSnippet.java b/source/net/yacy/search/snippet/TextSnippet.java
index 5c6bde107..dfeaf20e2 100644
--- a/source/net/yacy/search/snippet/TextSnippet.java
+++ b/source/net/yacy/search/snippet/TextSnippet.java
@@ -382,7 +382,7 @@ public class TextSnippet implements Comparable<TextSnippet>, Comparator<TextSnip
* @return line with marked words
*/
public String getLineMarked(final QueryGoal queryGoal) {
- final HandleSet queryHashes = queryGoal.getAllHashes();
+ final HandleSet queryHashes = queryGoal.getIncludeHashes();
if (this.line == null) {
return "";
}