Background: SOLR as a search tool, indexed by the traditional Lucene build, when updating the index file, the search does not appear update SOLR did do a fine caching mechanism, the cache with a specific searcher binding, compared to the normal cache, SOLR's cache does not expire after a period of time, unless searcher changes when you integrate SOLR into your application rather than using the SOLR server approach, this can be a hassle, and you have to write your own code to solve By analyzing SOLR's readercycle scripts and Solrupdateservlet, you can easily find the answer code as follows: Legacyupdatehandler = new Xmlupdaterequesthandler ();
Legacyupdatehandler.init (NULL);
BufferedReader requestreader = new BufferedReader (new StringReader ("<commit/>"));
Legacyupdatehandler.update (Requestreader); When you follow the new index file and then call this code, you will find similar results 2008-4-1:28:12 Org.apache.solr.update.DirectUpdateHandler2 Commit
Info: Start commit (optimize = false, Waitflush = False, Waitsearcher = True)
2008-4-1:28:12 Org.apache.solr.search.SolrIndexSearcher <init>
Info: Opening SEARCHER@1474FC Main
2008-4-1:28:12 Org.apache.solr.update.DirectUpdateHandler2 Commit
Info: End_commit_flush
2008-4-1:28:12 Org.apache.solr.search.SolrIndexSearcher Warm
Info: autowarming SEARCHER@1474FC main from searcher@c550 main
filtercache{lookups = 0, hits = 0, Hitratio = 0.00, inserts = 1, evictions = 0, size = 1, cumulative_lookups = 0, C umulative_hits = 0, Cumulative_hitratio = 0.00, Cumulative_inserts = 1, cumulative_evictions = 0}
2008-4-1:28:12 Org.apache.solr.search.SolrIndexSearcher Warm
Info: autowarming result for SEARCHER@1474FC main
filtercache{lookups = 0, hits = 0, Hitratio = 0.00, inserts = 1, evictions = 0, size = 1, cumulative_lookups = 0, C umulative_hits = 0, Cumulative_hitratio = 0.00, Cumulative_inserts = 1, cumulative_evictions = 0}
2008-4-1:28:12 Org.apache.solr.search.SolrIndexSearcher Warm
Info: autowarming SEARCHER@1474FC main from searcher@c550 main
queryresultcache{lookups = 1, hits = 0, Hitratio = 0.00, inserts = 1, evictions = 0, size = 1, cumulative_lookups = 1, cumulative_hits = 0, Cumulative_hitratio = 0.00, Cumulative_inserts = 1, cumulative_evictions = 0}
2008-4-1:28:12 Org.apache.solr.search.SolrIndexSearcher Warm
Info: autowarming result for SEARCHER@1474FC main
queryresultcache{lookups = 0, hits = 0, Hitratio = 0.00, inserts = 1, evictions = 0, size = 1, cumulative_lookups = 1, cumulative_hits = 0, Cumulative_hitratio = 0.00, Cumulative_inserts = 1, cumulative_evictions = 0}
2008-4-1:28:12 Org.apache.solr.search.SolrIndexSearcher Warm
Info: autowarming SEARCHER@1474FC main from searcher@c550 main
documentcache{lookups = 0, hits = 0, Hitratio = 0.00, inserts = 0, evictions = 0, size = 0, cumulative_lookups = 0, cumulative_hits = 0, Cumulative_hitratio = 0.00, Cumulative_inserts = 0, cumulative_evictions = 0}
2008-4-1:28:12 Org.apache.solr.search.SolrIndexSearcher Warm
Info: autowarming result for SEARCHER@1474FC main
documentcache{lookups = 0, hits = 0, Hitratio = 0.00, inserts = 0, evictions = 0, size = 0, cumulative_lookups = 0, cumulative_hits = 0, Cumulative_hitratio = 0.00, Cumulative_inserts = 0, cumulative_evictions = 0}
2008-4-1:28:12 Org.apache.solr.core.SolrCore Registersearcher
Info: Registered New Searcher SEARCHER@1474FC main
2008-4-1:28:12 Org.apache.solr.handler.XmlUpdateRequestHandler Update
Info: Commit 0 9
From the log, searcher really changed the new after you search again, the results are updated