1

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?

tuk
  • 5,941
  • 14
  • 79
  • 162

2 Answers2

0

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

Andrea
  • 2,714
  • 3
  • 27
  • 38
  • I was thinking if it is possible to get the version without making one more extra call getById. Can I get that as part of the update response when I am updating or adding a new document? – tuk Dec 12 '15 at 16:36
  • Mmmm no I don't think it is possible – Andrea Dec 12 '15 at 17:25
0

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

tuk
  • 5,941
  • 14
  • 79
  • 162