Skip to content

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

addendum to last commit handle words with length < 3 correctly

lotus1951d30a62dd
diff --git a/htroot/yacy/search.java b/htroot/yacy/search.java
index 4d5ccbfdb..ad8d429ba 100644
--- a/htroot/yacy/search.java
+++ b/htroot/yacy/search.java
@@ -180,7 +180,7 @@ public final class search {
plasmaSearchEvent theSearch = null;
if ((query.length() == 0) && (abstractSet != null)) {
// this is _not_ a normal search, only a request for index abstracts
- theQuery = new plasmaSearchQuery(null, abstractSet, new TreeSet<String>(kelondroBase64Order.enhancedComparator), rankingProfile, maxdist, prefer, plasmaSearchQuery.contentdomParser(contentdom), language, false, count, 0, filter, plasmaSearchQuery.SEARCHDOM_LOCAL, null, -1, null, false, yacyURL.TLD_any_zone_filter, client, false);
+ theQuery = new plasmaSearchQuery(null, abstractSet, new TreeSet<String>(kelondroBase64Order.enhancedComparator), null, rankingProfile, maxdist, prefer, plasmaSearchQuery.contentdomParser(contentdom), language, false, count, 0, filter, plasmaSearchQuery.SEARCHDOM_LOCAL, null, -1, null, false, yacyURL.TLD_any_zone_filter, client, false);
theQuery.domType = plasmaSearchQuery.SEARCHDOM_LOCAL;
yacyCore.log.logInfo("INIT HASH SEARCH (abstracts only): " + plasmaSearchQuery.anonymizedQueryHashes(theQuery.queryHashes) + " - " + theQuery.displayResults() + " links");
@@ -206,7 +206,7 @@ public final class search {
} else {
// retrieve index containers from search request
- theQuery = new plasmaSearchQuery(null, queryhashes, excludehashes, rankingProfile, maxdist, prefer, plasmaSearchQuery.contentdomParser(contentdom), language, false, count, 0, filter, plasmaSearchQuery.SEARCHDOM_LOCAL, null, -1, constraint, false, yacyURL.TLD_any_zone_filter, client, false);
+ theQuery = new plasmaSearchQuery(null, queryhashes, excludehashes, null, rankingProfile, maxdist, prefer, plasmaSearchQuery.contentdomParser(contentdom), language, false, count, 0, filter, plasmaSearchQuery.SEARCHDOM_LOCAL, null, -1, constraint, false, yacyURL.TLD_any_zone_filter, client, false);
theQuery.domType = plasmaSearchQuery.SEARCHDOM_LOCAL;
yacyCore.log.logInfo("INIT HASH SEARCH (query-" + abstracts + "): " + plasmaSearchQuery.anonymizedQueryHashes(theQuery.queryHashes) + " - " + theQuery.displayResults() + " links");
RSSFeed.channels(RSSFeed.REMOTESEARCH).addMessage(new RSSMessage("Remote Search Request from " + ((remoteSeed == null) ? "unknown" : remoteSeed.getName()), plasmaSearchQuery.anonymizedQueryHashes(theQuery.queryHashes), ""));
diff --git a/htroot/yacy/user/ysearch.java b/htroot/yacy/user/ysearch.java
index 8f8f9f7cb..294757981 100644
--- a/htroot/yacy/user/ysearch.java
+++ b/htroot/yacy/user/ysearch.java
@@ -207,7 +207,8 @@ public class ysearch {
querystring,
queryHashes,
indexWord.words2hashes(query[1]),
- ranking,
+ indexWord.words2hashes(query[2]),
+ ranking,
maxDistance,
prefermask,
contentdomCode,
diff --git a/htroot/yacy/user/ysearchitem.java b/htroot/yacy/user/ysearchitem.java
index dd68ab87d..3b000db7f 100644
--- a/htroot/yacy/user/ysearchitem.java
+++ b/htroot/yacy/user/ysearchitem.java
@@ -134,7 +134,7 @@ public class ysearchitem {
((yacyURL.probablyRootURL(result.hash())) ? ", probablyRootURL" : "") +
(((wordURL = yacyURL.probablyWordURL(result.hash(), query[0])) != null) ? ", probablyWordURL=" + wordURL.toNormalform(false, true) : ""));
final plasmaSnippetCache.TextSnippet snippet = result.textSnippet();
- prop.put("content_snippet", (snippet == null) ? "(snippet not found)" : snippet.getLineMarked(theQuery.queryHashes));
+ prop.put("content_snippet", (snippet == null) ? "(snippet not found)" : snippet.getLineMarked(theQuery.fullqueryHashes));
return prop;
}
diff --git a/htroot/yacysearch.java b/htroot/yacysearch.java
index a4bbe8ec4..cc07065c7 100644
--- a/htroot/yacysearch.java
+++ b/htroot/yacysearch.java
@@ -282,7 +282,8 @@ public class yacysearch {
querystring,
queryHashes,
indexWord.words2hashes(query[1]),
- ranking,
+ indexWord.words2hashes(query[2]),
+ ranking,
maxDistance,
prefermask,
contentdomCode,
diff --git a/source/de/anomic/plasma/plasmaSearchQuery.java b/source/de/anomic/plasma/plasmaSearchQuery.java
index 854eccb42..7972b8a0a 100644
--- a/source/de/anomic/plasma/plasmaSearchQuery.java
+++ b/source/de/anomic/plasma/plasmaSearchQuery.java
@@ -117,6 +117,7 @@ public final class plasmaSearchQuery {
public plasmaSearchQuery(
final String queryString, final TreeSet<String> queryHashes,
final TreeSet<String> excludeHashes,
+ final TreeSet<String> fullqueryHashes,
final plasmaSearchRankingProfile ranking,
final int maxDistance, final String prefer, final int contentdom,
final String language,
@@ -130,7 +131,7 @@ public final class plasmaSearchQuery {
this.queryString = queryString;
this.queryHashes = queryHashes;
this.excludeHashes = excludeHashes;
- this.fullqueryHashes = queryHashes; //FIXME: refactor this method to get the proper hashes
+ this.fullqueryHashes = fullqueryHashes;
this.ranking = ranking;
this.maxDistance = maxDistance;
this.prefer = prefer;
@@ -248,6 +249,7 @@ public final class plasmaSearchQuery {
}
String s;
+ int l;
// the string is clean now, but we must generate a set out of it
final TreeSet<String> query = new TreeSet<String>(kelondroNaturalOrder.naturalComparator);
final TreeSet<String> exclude = new TreeSet<String>(kelondroNaturalOrder.naturalComparator);
@@ -259,12 +261,14 @@ public final class plasmaSearchQuery {
} else {
while ((c = a[i].indexOf('-')) >= 0) {
s = a[i].substring(0, c);
- if(s.length() > 2) query.add(s);
- fullquery.add(s);
+ l = s.length();
+ if(l > 2) query.add(s);
+ if(l > 0) fullquery.add(s);
a[i] = a[i].substring(c + 1);
}
- if (a[i].length() > 2) query.add(a[i]);
- fullquery.add(a[i]);
+ l = a[i].length();
+ if (l > 2) query.add(a[i]);
+ if (l > 0) fullquery.add(a[i]);
}
}
return new TreeSet[]{query, exclude, fullquery};