You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by eg...@gmx.de on 2009/10/23 18:33:11 UTC
Issues adding document to EmbeddedSolrServer
Hi everybody,
I just started playing with Solr and think of it as a quite useful tool!
I'm using Solrj (Solr 1.3) in combination with an EmbeddedSolrServer. I
managed to get the server running and implemented a method (following the
Solrj Wiki) to create a document and add it to the server's index. The
method looks like the following:
public void fillIndex() {
SolrInputDocument doc1 = new SolrInputDocument();
doc1.addField("id", "id1", 1.0f);
doc1.addField("name", "doc1", 1.0f);
doc1.addField("price", 10);
try {
server.add(doc1);
} catch (Exception e) {
e.printStackTrace();
}
try {
server.commit(true, true);
} catch (Exception e) {
e.printStackTrace();
}
}
My problem now is, that the method server.add() never finishes which leads
the the whole fillIndex() method to crash. It's like it throws an
exception, which is not catched and the server.commit() is never executed.
I already used the maxTime configuration in the solrconfig.xml to commit
new documents automatically. This looks like the following:
<autoCommit>
<maxDocs>10000</maxDocs>
<maxTime>1000</maxTime>
</autoCommit>
This works. But I want the explicit commit to work, as this looks like the
way it should be done! In addition, this would give me better control over
adding new stuff.
I assume this problem won't be the big challenge for an expert. :)
Any hints are appreciated!!
Thanks in advance.
Egon
--
Jetzt kostenlos herunterladen: Internet Explorer 8 und Mozilla Firefox 3.5 -
sicherer, schneller und einfacher! http://portal.gmx.net/de/go/atbrowser