As of today the SolrNet api doesn't offer atomic updates to be issued to a running Solr server. While the Solrnet api is supposed to offer this feature sometime in the future, the following alternative can be used in the interim.
1. Build a custom atomic update XML message:
(See: http://wiki.apache.org/solr/UpdateXmlMessages for more details)
2. Get hold of the connection object (via ServiceLocator):
3. Issue a call to Solr via the connection object:
Will be adding sample code snippets soon..
1. Build a custom atomic update XML message:
(See: http://wiki.apache.org/solr/UpdateXmlMessages for more details)
2. Get hold of the connection object (via ServiceLocator):
3. Issue a call to Solr via the connection object:
Will be adding sample code snippets soon..
Thanks for this. Works a treat.
ReplyDeleteOf course, risking stating the obvious, since you're using some sort of DI, don't bother with ServiceLocator; rather, just inject ISolrConnection and you'll have your connection without having to construct/determine the connection string etc. In addition, you'll need to _solr.Commit() following.
Glad that it helps. With DI, as you rightly pointed out, ServiceLocator wouldn't be necessary.
DeleteOn the bit about commit, I'd suggest configuring soft & auto commits appropriately on Solr 4.x side. This ends up being a design trade off between visibility & durability. Here's a good explanation on it from Erick: http://searchhub.org/2013/08/23/understanding-transaction-logs-softcommit-and-commit-in-sorlcloud/
This comment has been removed by a blog administrator.
ReplyDelete