开发者

SolrJ's UpdateRequest worth trying instead setting autoCommit in config?

I am开发者_JAVA技巧 getting sometimes timeouts while inserting documents into Solr with SolrJ. Now I am searching for a solution and thought, maybe the autocommit could be a possible approach. I can set it directly in the solrConfig.xml or I can use CommitWithin in e.g. SorlJ.

Currently I am inserting documents, via addBeans, which is nice, because it's so comfortable.

The UpdateRequest only offers me the possibility to add SolrInputDocuments directly, so no beans. E.g. from http://wiki.apache.org/solr/CommitWithin:

   UpdateRequest req = new UpdateRequest();
   req.add(mySolrInputDocument);
   req.setCommitWithin(10000);
   req.process(server);

I don't know, if the general autoCommit is wise to set. It sounds like a 'hard' approach to me. And when I read the comment written in the solrconfig.xml

Instead of enabling autoCommit, consider using "commitWithin" when adding documents.

I'm even more against this solution. Is the CommitWithin the smarter solution, which then of course means to write more code?

BTW: is it possible to add beans using the commitWithin feature?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜