added clear-text search words in query params

pull/1/head
Michael Peter Christen 12 years ago
parent efafa79db5
commit 6197caf698

@ -47,6 +47,7 @@ import net.yacy.cora.protocol.RequestHeader;
import net.yacy.cora.sorting.ScoreMap; import net.yacy.cora.sorting.ScoreMap;
import net.yacy.cora.sorting.WeakPriorityBlockingQueue; import net.yacy.cora.sorting.WeakPriorityBlockingQueue;
import net.yacy.cora.storage.HandleSet; import net.yacy.cora.storage.HandleSet;
import net.yacy.cora.util.SpaceExceededException;
import net.yacy.kelondro.data.meta.DigestURI; import net.yacy.kelondro.data.meta.DigestURI;
import net.yacy.kelondro.data.word.WordReference; import net.yacy.kelondro.data.word.WordReference;
import net.yacy.kelondro.data.word.WordReferenceFactory; import net.yacy.kelondro.data.word.WordReferenceFactory;
@ -221,9 +222,10 @@ public final class search {
final Segment indexSegment = sb.index; final Segment indexSegment = sb.index;
theQuery = new QueryParams( theQuery = new QueryParams(
null, null,
null, null, null,
abstractSet, abstractSet,
new RowHandleSet(WordReferenceRow.urlEntryRow.primaryKeyLength, WordReferenceRow.urlEntryRow.objectOrder, 0), new RowHandleSet(WordReferenceRow.urlEntryRow.primaryKeyLength, WordReferenceRow.urlEntryRow.objectOrder, 0),
null, abstractSet,
null, null,
modifier, modifier,
maxdist, maxdist,
@ -281,11 +283,15 @@ public final class search {
} else { } else {
// retrieve index containers from search request // retrieve index containers from search request
RowHandleSet allHashes = new RowHandleSet(WordReferenceRow.urlEntryRow.primaryKeyLength, WordReferenceRow.urlEntryRow.objectOrder, 0);
try {allHashes.putAll(queryhashes);} catch (SpaceExceededException e) {}
try {allHashes.putAll(excludehashes);} catch (SpaceExceededException e) {}
theQuery = new QueryParams( theQuery = new QueryParams(
null, null,
null, null, null,
queryhashes, queryhashes,
excludehashes, excludehashes,
null, allHashes,
null, null,
modifier, modifier,
maxdist, maxdist,

@ -51,7 +51,6 @@ import net.yacy.cora.protocol.HeaderFramework;
import net.yacy.cora.protocol.RequestHeader; import net.yacy.cora.protocol.RequestHeader;
import net.yacy.cora.protocol.ResponseHeader; import net.yacy.cora.protocol.ResponseHeader;
import net.yacy.cora.services.federated.yacy.CacheStrategy; import net.yacy.cora.services.federated.yacy.CacheStrategy;
import net.yacy.cora.storage.HandleSet;
import net.yacy.document.Condenser; import net.yacy.document.Condenser;
import net.yacy.document.Document; import net.yacy.document.Document;
import net.yacy.document.LibraryProvider; import net.yacy.document.LibraryProvider;
@ -712,9 +711,6 @@ public class yacysearch {
} }
} }
// do the search
final HandleSet queryHashes = Word.words2hashesHandles(query[0]);
// check filters // check filters
try { try {
Pattern.compile(urlmask); Pattern.compile(urlmask);
@ -734,10 +730,14 @@ public class yacysearch {
prefermask = ""; prefermask = "";
} }
// do the search
final QueryParams theQuery = final QueryParams theQuery =
new QueryParams( new QueryParams(
originalquerystring, originalquerystring,
queryHashes, query[0],
query[1],
query[2],
Word.words2hashesHandles(query[0]),
Word.words2hashesHandles(query[1]), Word.words2hashesHandles(query[1]),
Word.words2hashesHandles(query[2]), Word.words2hashesHandles(query[2]),
tenant, tenant,

@ -107,8 +107,8 @@ public final class QueryParams {
public static final Pattern matchnothing_pattern = Pattern.compile(""); public static final Pattern matchnothing_pattern = Pattern.compile("");
public final String queryString; public final String queryString;
public HandleSet query_include_hashes, query_exclude_hashes, query_all_hashes; public final HandleSet query_include_hashes, query_exclude_hashes, query_all_hashes;
public Collection<String> query_include_words, query_exclude_words, query_all_words = new ArrayList<String>(); public final Collection<String> query_include_words, query_exclude_words, query_all_words;
public final int itemsPerPage; public final int itemsPerPage;
public int offset; public int offset;
public final Pattern urlMask, prefer; public final Pattern urlMask, prefer;
@ -153,16 +153,24 @@ public final class QueryParams {
byte[] queryHash; byte[] queryHash;
if ((queryString.length() == 12) && (Base64Order.enhancedCoder.wellformed(queryHash = UTF8.getBytes(queryString)))) { if ((queryString.length() == 12) && (Base64Order.enhancedCoder.wellformed(queryHash = UTF8.getBytes(queryString)))) {
this.queryString = null; this.queryString = null;
this.query_include_words = null;
this.query_exclude_words = null;
this.query_all_words = null;
this.query_include_hashes = new RowHandleSet(WordReferenceRow.urlEntryRow.primaryKeyLength, WordReferenceRow.urlEntryRow.objectOrder, 0); this.query_include_hashes = new RowHandleSet(WordReferenceRow.urlEntryRow.primaryKeyLength, WordReferenceRow.urlEntryRow.objectOrder, 0);
this.query_exclude_hashes = new RowHandleSet(WordReferenceRow.urlEntryRow.primaryKeyLength, WordReferenceRow.urlEntryRow.objectOrder, 0); this.query_exclude_hashes = new RowHandleSet(WordReferenceRow.urlEntryRow.primaryKeyLength, WordReferenceRow.urlEntryRow.objectOrder, 0);
this.query_all_hashes = new RowHandleSet(WordReferenceRow.urlEntryRow.primaryKeyLength, WordReferenceRow.urlEntryRow.objectOrder, 0);
try { try {
this.query_include_hashes.put(queryHash); this.query_include_hashes.put(queryHash);
this.query_all_hashes.put(queryHash);
} catch (final SpaceExceededException e) { } catch (final SpaceExceededException e) {
Log.logException(e); Log.logException(e);
} }
} else { } else {
this.queryString = queryString; this.queryString = queryString;
final Collection<String>[] cq = cleanQuery(queryString); final Collection<String>[] cq = cleanQuery(queryString);
this.query_include_words = cq[0];
this.query_exclude_words = cq[1];
this.query_all_words = cq[2];
this.query_include_hashes = Word.words2hashesHandles(cq[0]); this.query_include_hashes = Word.words2hashesHandles(cq[0]);
this.query_exclude_hashes = Word.words2hashesHandles(cq[1]); this.query_exclude_hashes = Word.words2hashesHandles(cq[1]);
this.query_all_hashes = Word.words2hashesHandles(cq[2]); this.query_all_hashes = Word.words2hashesHandles(cq[2]);
@ -207,6 +215,9 @@ public final class QueryParams {
public QueryParams( public QueryParams(
final String queryString, final String queryString,
final Collection<String> queryWords,
final Collection<String> excludeWords,
final Collection<String> fullqueryWords,
final HandleSet queryHashes, final HandleSet queryHashes,
final HandleSet excludeHashes, final HandleSet excludeHashes,
final HandleSet fullqueryHashes, final HandleSet fullqueryHashes,
@ -233,6 +244,9 @@ public final class QueryParams {
final double lat, final double lon, final double radius) { final double lat, final double lon, final double radius) {
this.queryString = queryString; this.queryString = queryString;
this.query_include_words = queryWords;
this.query_exclude_words = excludeWords;
this.query_all_words = fullqueryWords;
this.query_include_hashes = queryHashes; this.query_include_hashes = queryHashes;
this.query_exclude_hashes = excludeHashes; this.query_exclude_hashes = excludeHashes;
this.query_all_hashes = fullqueryHashes; this.query_all_hashes = fullqueryHashes;
@ -389,7 +403,7 @@ public final class QueryParams {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public static Collection<String>[] cleanQuery(String querystring) { public static Collection<String>[] cleanQuery(String querystring) {
// returns three sets: a query set, a exclude set and a full query set // returns three sets: a query set, an exclude set and a full query set
final Collection<String> query_include_words = new ArrayList<String>(); final Collection<String> query_include_words = new ArrayList<String>();
final Collection<String> query_exclude_words = new ArrayList<String>(); final Collection<String> query_exclude_words = new ArrayList<String>();
final Collection<String> query_all_words = new ArrayList<String>(); final Collection<String> query_all_words = new ArrayList<String>();

Loading…
Cancel
Save