Chart Search module consists of 3 projects:
The server project doesn't have any OpenMRS dependencies. It contains custom Data Import Handler.
The api project contains classes interacts with Solr via SolrJ library: ChartSearchSearcher and ChartSearchIndexer. The first one makes requests to select handler, the second one - to ChartSearchDataImportHandler.
Omod project has chart search portlet, settings and commands pages.
EmbeddedSolr was choosed instead of Lucene because SolrJ has common interface for EmbeddedSolr and separated Solr server. It makes easier to migrate from EmbeddedSolr to dedicated Solr.
DIH doesn't cover all requirements. It cannot import data asynchronously. Custom handler uses requests queue and daemons, that takes requests from queue and handles them.
ChartSearchDataImportHandler locates in org.apache.solr.handler.dataimport package. This is due to the fact that Solr DataImporter class has package-level access modifier.
There are two scheduler daemons started by handler: scheduler that periodically cleans index and scheduler that writes PatientInfoCache to file.
Index clear scheduler uses IndexClearStrategy to change how to prune patients.
PatientInfoCache contains patients last index time. This time is used to import only delta data. In future that class should contain patient index state.
Solr stores in singleton and loads lazy. It caused by Spring dependency issues.