tuk
tuk

Reputation: 6852

Getting document version back after update in Solr5

Is there a way I can get the version of a document back in update response after adding or updating the document via Solrj 5.2.1? I don't want to make one more extra call getById to get the version. Can I somehow get the version in the Update response itself?

Upvotes: 1

Views: 193

Answers (2)

tuk
tuk

Reputation: 6852

As per the discussion I had in solr mailing list. The version number can be obtained in update response by setting versions=true flag in each update requests. This is described here towards the end.

In SolrJ this can be set as follows:- UpdateRequest().getParam().add("versions","true")

Upvotes: 0

Andrea
Andrea

Reputation: 2764

You can use the Realtime Get handler (in the default comfiguration it answers to /get requests). Just pass the document id as input parameter.

Upvotes: 0

Related Questions