bugfix for solr connector, possibly a cause for

http://forum.yacy-websuche.de/viewtopic.php?p=26893#p26893
pull/1/head
Michael Peter Christen 13 years ago
parent 9bece5ac5f
commit 54bea21c02

@ -228,34 +228,19 @@ public class MirrorSolrConnector implements SolrConnector {
*/ */
@Override @Override
public void add(final SolrInputDocument solrdoc) throws IOException { public void add(final SolrInputDocument solrdoc) throws IOException {
if (this.solr0 != null) {
this.solr0.add(solrdoc);
}
if (this.solr1 != null) {
this.solr1.add(solrdoc);
}
String id = (String) solrdoc.getFieldValue(YaCySchema.id.name()); String id = (String) solrdoc.getFieldValue(YaCySchema.id.name());
if (id != null) { assert id != null;
this.hitCache.put(id, EXIST); if (id == null) return;
this.documentCache.put(id, ClientUtils.toSolrDocument(solrdoc)); this.missCache.remove(id);
} this.documentCache.put(id, ClientUtils.toSolrDocument(solrdoc));
if (this.solr0 != null) this.solr0.add(solrdoc);
if (this.solr1 != null) this.solr1.add(solrdoc);
this.hitCache.put(id, EXIST);
} }
@Override @Override
public void add(final Collection<SolrInputDocument> solrdocs) throws IOException, SolrException { public void add(final Collection<SolrInputDocument> solrdocs) throws IOException, SolrException {
if (this.solr0 != null) { for (SolrInputDocument solrdoc: solrdocs) add(solrdoc);
for (SolrInputDocument d: solrdocs) this.solr0.add(d);
}
if (this.solr1 != null) {
for (SolrInputDocument d: solrdocs) this.solr1.add(d);
}
for (SolrInputDocument solrdoc: solrdocs) {
String id = (String) solrdoc.getFieldValue(YaCySchema.id.name());
if (id != null) {
this.hitCache.put(id, EXIST);
this.documentCache.put(id, ClientUtils.toSolrDocument(solrdoc));
}
}
} }
/** /**

Loading…
Cancel
Save