fixes to index enumeration for vocabulary production

pull/1/head
orbiter 12 years ago
parent be5d3a1066
commit ecc10a752c

@ -28,6 +28,7 @@ package net.yacy.search.index;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.net.MalformedURLException;
import java.util.Date; import java.util.Date;
import java.util.Iterator; import java.util.Iterator;
import java.util.Map; import java.util.Map;
@ -221,7 +222,7 @@ public class Segment {
public Iterator<DigestURI> urlSelector(MultiProtocolURI stub) { public Iterator<DigestURI> urlSelector(MultiProtocolURI stub) {
final String host = stub.getHost(); final String host = stub.getHost();
String hh = DigestURI.hosthash(host); String hh = DigestURI.hosthash(host);
final BlockingQueue<String> hostQueue = this.fulltext.getSolr().concurrentIDs(YaCySchema.host_id_s + ":" + hh, 0, Integer.MAX_VALUE, 10000); final BlockingQueue<SolrDocument> docQueue = this.fulltext.getSolr().concurrentQuery(YaCySchema.host_id_s + ":\"" + hh + "\"", 0, Integer.MAX_VALUE, 600000L, 100000, YaCySchema.id.getSolrFieldName(), YaCySchema.sku.getSolrFieldName());
final String urlstub = stub.toNormalform(true); final String urlstub = stub.toNormalform(true);
@ -230,16 +231,23 @@ public class Segment {
@Override @Override
protected DigestURI next0() { protected DigestURI next0() {
while (true) { while (true) {
String id; SolrDocument doc;
try { try {
id = hostQueue.take(); doc = docQueue.take();
} catch (InterruptedException e) { } catch (InterruptedException e) {
Log.logException(e); Log.logException(e);
return null; return null;
} }
if (id == null || id == AbstractSolrConnector.POISON_ID) return null; if (doc == null || doc == AbstractSolrConnector.POISON_DOCUMENT) return null;
DigestURI u = Segment.this.fulltext.getURL(ASCII.getBytes(id)); String u = (String) doc.getFieldValue(YaCySchema.sku.getSolrFieldName());
if (u.toNormalform(true).startsWith(urlstub)) return u; String id = (String) doc.getFieldValue(YaCySchema.id.getSolrFieldName());
DigestURI url;
try {
url = new DigestURI(u, ASCII.getBytes(id));
} catch (MalformedURLException e) {
continue;
}
if (u.startsWith(urlstub)) return url;
} }
} }
}; };

Loading…
Cancel
Save