Search code examples
apachesolrindexinge-commercefacet

how to find out if content has already been indexed by Apache Solr


I am working on adding the search capabilities for an e-commerce project and I need to integrate the Apache Solr search server for the searching. I was able to index the site content with Apache Solr, but the problem is whenever a user is searching all the product content is indexed in the apache solr even if it has been indexed already. Is there any way in which I can find out if my content has already been indexed by Apache Solr so that I need not index the content again

Thanks


Solution

  • If you are holding data in DB and then indexing it with Solr the solution is easy. Add timestamp column to the data in DB, and Solr. Then periodically check latest timestamps in both. When they are not equal, add to index content with newer timestamp.

    You can do that with correct query in DIH. For more read: