How to get last indexed record in Solr?

后端 未结 2 1631
野的像风
野的像风 2021-01-02 06:17

I want to know how to get/search last indexed record in Apache Solr..?

When the existing record is updated then it goes to end of all the records...so I want to get

2条回答
  •  独厮守ぢ
    2021-01-02 06:48

    You could add a 'timestamp' field to your Solr schema that puts the current date/time into the record when it is added.

    
    

    Then, do a sort in descending order by this field and the first record will be the latest one. A query like this should do it:-

    http://localhost:8080/solr/core-name/select/q=*%3A*&start=0&rows=1&sort=timestamp+desc

提交回复
热议问题