mirror of
https://github.com/yacy/yacy_search_server.git
synced 2024-09-19 00:01:41 +02:00
- fix for problem with concurrency when computing word hashes
- fix for search in case that a urlfilter was used and zero results were returned git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@5904 6c8d7289-2bf4-0310-a012-ef5d649a1542
This commit is contained in:
parent
d3f8aa5a2a
commit
3a64c9d02f
|
@ -82,11 +82,15 @@ public class Word {
|
|||
|
||||
// create a word hash
|
||||
public static final byte[] word2hash(final String word) {
|
||||
byte[] h = hashCache.get(word);
|
||||
byte[] h = hashCache.get(word);
|
||||
if (h != null) return h;
|
||||
h = Base64Order.enhancedCoder.encodeSubstring(Digest.encodeMD5Raw(word.toLowerCase(Locale.ENGLISH)), yacySeedDB.commonHashLength);
|
||||
assert h[2] != '@';
|
||||
hashCache.put(word, h); // prevent expensive MD5 computation and encoding
|
||||
synchronized(hashCache) {
|
||||
h = hashCache.get(word); // we must test that again because another thread may have written the value in between
|
||||
if (h != null) return h;
|
||||
h = Base64Order.enhancedCoder.encodeSubstring(Digest.encodeMD5Raw(word.toLowerCase(Locale.ENGLISH)), yacySeedDB.commonHashLength);
|
||||
assert h[2] != '@';
|
||||
hashCache.put(word, h); // prevent expensive MD5 computation and encoding
|
||||
}
|
||||
return h;
|
||||
}
|
||||
|
||||
|
|
|
@ -301,7 +301,7 @@ public final class plasmaSearchRankingProcess {
|
|||
}
|
||||
|
||||
public URLMetadataRow bestURL(final boolean skipDoubleDom) {
|
||||
// returns from the current RWI list the best URL entry and removed this entry from the list
|
||||
// returns from the current RWI list the best URL entry and removes this entry from the list
|
||||
while ((stack.size() > 0) || (size() > 0)) {
|
||||
if (((stack.size() == 0) && (size() == 0))) break;
|
||||
final SortStack<WordReferenceVars>.stackElement obrwi = bestRWI(skipDoubleDom);
|
||||
|
@ -309,8 +309,12 @@ public final class plasmaSearchRankingProcess {
|
|||
final URLMetadataRow u = wordIndex.metadata().load(obrwi.element.metadataHash(), obrwi.element, obrwi.weight.longValue());
|
||||
if (u != null) {
|
||||
final URLMetadataRow.Components metadata = u.metadata();
|
||||
if (metadata.url() != null) this.handover.put(u.hash(), metadata.url().toNormalform(true, false)); // remember that we handed over this url
|
||||
return u;
|
||||
if (metadata.url() != null) {
|
||||
String urlstring = metadata.url().toNormalform(true, true);
|
||||
if (urlstring == null || !urlstring.matches(query.urlMask)) continue;
|
||||
this.handover.put(u.hash(), metadata.url().toNormalform(true, false)); // remember that we handed over this url
|
||||
return u;
|
||||
}
|
||||
}
|
||||
misses.add(obrwi.element.metadataHash());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user