hi all, I want to know the detail of IndexReader in SolrCore. I read a little codes of SolrCore. Here is my understanding, are they correct? Each SolrCore has many SolrIndexSearcher and keeps them in _searchers. and _searcher keep trace of the latest version of index. Each SolrIndexSearcher has a SolrIndexReader. If there isn't any update, all these searchers share one single SolrIndexReader. If there is an update, then a newSearcher will be created and a new SolrIndexReader associated with it. I did a simple test. A thread do a query and blocked by breakpoint. Then I feed some data to update index. When commit, a newSearcher is created. Here is the debug info:
SolrCore _searcher [solrindexsearc...@...ab] _searchers[solrindexsearc...@...77,solrindexsearc...@...ab,solrindexsearc...@..f8] solrindexsearc...@...77 's SolrIndexReader is old one and ab and f8 share the same newest SolrIndexReader When query finished solrindexsearc...@...77 is discarded. When newSearcher success to warmup, There is only one SolrIndexSearcher. The SolrIndexReader of old version of index is discarded and only segments in newest SolrIndexReader are referenced. Those segments not in new version can then be deleted because no file pointer reference them . Then I start 3 queries. There is only one SolrIndexSearcher but RefCount=4. It seems many search can share one single SolrIndexSearcher. So in which situation, there will exist more than one SolrIndexSearcher that they share just one SolrIndexReader? Another question, for each version of index, is there just one SolrIndexReader instance associated with it? will it occur that more than one SolrIndexReader are opened and they are the same version of index?