addendum to last commit

handle words with length < 3 correctly

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@5369 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
lotus 17 years ago
parent 325ba7bfb8
commit 1951d30a62

@ -180,7 +180,7 @@ public final class search {
plasmaSearchEvent theSearch = null; plasmaSearchEvent theSearch = null;
if ((query.length() == 0) && (abstractSet != null)) { if ((query.length() == 0) && (abstractSet != null)) {
// this is _not_ a normal search, only a request for index abstracts // 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; theQuery.domType = plasmaSearchQuery.SEARCHDOM_LOCAL;
yacyCore.log.logInfo("INIT HASH SEARCH (abstracts only): " + plasmaSearchQuery.anonymizedQueryHashes(theQuery.queryHashes) + " - " + theQuery.displayResults() + " links"); yacyCore.log.logInfo("INIT HASH SEARCH (abstracts only): " + plasmaSearchQuery.anonymizedQueryHashes(theQuery.queryHashes) + " - " + theQuery.displayResults() + " links");
@ -206,7 +206,7 @@ public final class search {
} else { } else {
// retrieve index containers from search request // 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; theQuery.domType = plasmaSearchQuery.SEARCHDOM_LOCAL;
yacyCore.log.logInfo("INIT HASH SEARCH (query-" + abstracts + "): " + plasmaSearchQuery.anonymizedQueryHashes(theQuery.queryHashes) + " - " + theQuery.displayResults() + " links"); 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), "")); RSSFeed.channels(RSSFeed.REMOTESEARCH).addMessage(new RSSMessage("Remote Search Request from " + ((remoteSeed == null) ? "unknown" : remoteSeed.getName()), plasmaSearchQuery.anonymizedQueryHashes(theQuery.queryHashes), ""));

@ -207,7 +207,8 @@ public class ysearch {
querystring, querystring,
queryHashes, queryHashes,
indexWord.words2hashes(query[1]), indexWord.words2hashes(query[1]),
ranking, indexWord.words2hashes(query[2]),
ranking,
maxDistance, maxDistance,
prefermask, prefermask,
contentdomCode, contentdomCode,

@ -134,7 +134,7 @@ public class ysearchitem {
((yacyURL.probablyRootURL(result.hash())) ? ", probablyRootURL" : "") + ((yacyURL.probablyRootURL(result.hash())) ? ", probablyRootURL" : "") +
(((wordURL = yacyURL.probablyWordURL(result.hash(), query[0])) != null) ? ", probablyWordURL=" + wordURL.toNormalform(false, true) : "")); (((wordURL = yacyURL.probablyWordURL(result.hash(), query[0])) != null) ? ", probablyWordURL=" + wordURL.toNormalform(false, true) : ""));
final plasmaSnippetCache.TextSnippet snippet = result.textSnippet(); 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; return prop;
} }

@ -282,7 +282,8 @@ public class yacysearch {
querystring, querystring,
queryHashes, queryHashes,
indexWord.words2hashes(query[1]), indexWord.words2hashes(query[1]),
ranking, indexWord.words2hashes(query[2]),
ranking,
maxDistance, maxDistance,
prefermask, prefermask,
contentdomCode, contentdomCode,

@ -117,6 +117,7 @@ public final class plasmaSearchQuery {
public plasmaSearchQuery( public plasmaSearchQuery(
final String queryString, final TreeSet<String> queryHashes, final String queryString, final TreeSet<String> queryHashes,
final TreeSet<String> excludeHashes, final TreeSet<String> excludeHashes,
final TreeSet<String> fullqueryHashes,
final plasmaSearchRankingProfile ranking, final plasmaSearchRankingProfile ranking,
final int maxDistance, final String prefer, final int contentdom, final int maxDistance, final String prefer, final int contentdom,
final String language, final String language,
@ -130,7 +131,7 @@ public final class plasmaSearchQuery {
this.queryString = queryString; this.queryString = queryString;
this.queryHashes = queryHashes; this.queryHashes = queryHashes;
this.excludeHashes = excludeHashes; this.excludeHashes = excludeHashes;
this.fullqueryHashes = queryHashes; //FIXME: refactor this method to get the proper hashes this.fullqueryHashes = fullqueryHashes;
this.ranking = ranking; this.ranking = ranking;
this.maxDistance = maxDistance; this.maxDistance = maxDistance;
this.prefer = prefer; this.prefer = prefer;
@ -248,6 +249,7 @@ public final class plasmaSearchQuery {
} }
String s; String s;
int l;
// the string is clean now, but we must generate a set out of it // 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> query = new TreeSet<String>(kelondroNaturalOrder.naturalComparator);
final TreeSet<String> exclude = new TreeSet<String>(kelondroNaturalOrder.naturalComparator); final TreeSet<String> exclude = new TreeSet<String>(kelondroNaturalOrder.naturalComparator);
@ -259,12 +261,14 @@ public final class plasmaSearchQuery {
} else { } else {
while ((c = a[i].indexOf('-')) >= 0) { while ((c = a[i].indexOf('-')) >= 0) {
s = a[i].substring(0, c); s = a[i].substring(0, c);
if(s.length() > 2) query.add(s); l = s.length();
fullquery.add(s); if(l > 2) query.add(s);
if(l > 0) fullquery.add(s);
a[i] = a[i].substring(c + 1); a[i] = a[i].substring(c + 1);
} }
if (a[i].length() > 2) query.add(a[i]); l = a[i].length();
fullquery.add(a[i]); if (l > 2) query.add(a[i]);
if (l > 0) fullquery.add(a[i]);
} }
} }
return new TreeSet[]{query, exclude, fullquery}; return new TreeSet[]{query, exclude, fullquery};

Loading…
Cancel
Save