lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shawn Heisey <>
Subject Re: SolrJ commit with openSearcher=false
Date Tue, 31 Mar 2015 06:40:35 GMT
On 3/31/2015 12:25 AM, vidit.asthana wrote:
> How can I issue a hard commit through SolrJ such that openSearcher=false?
> Also how can I issue same request through http? Will this work - 
> curl
> "http://localhost:8983/solr/collection1/update?commit=true&openSearcher=false"

This SolrJ code should do a hard commit with openSearcher set to false,
assuming "server" is an instance of SolrServer (SolrClient in 5.0):

  UpdateRequest req = new UpdateRequest();
  req.setAction(UpdateRequest.ACTION.COMMIT, true, true);
  req.setParam("openSearcher", "false");
  UpdateResponse ur = req.process(server);

I *think* the curl command you have indicated would do the same thing,
but I haven't tried it.

Personally, I would just use autoCommit to handle the hard commits with
openSearcher=false, and do soft commits in my application to control
document visibility.  You can make all commits automated by adding
autoSoftCommit to the config or using commitWithin on the udpate
requests, but I like to be completely in control of when new documents
become visible.


View raw message