Search code examples
solrsolrjsolr5

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?


Solution

  • 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")