I want to load full text into an external cache, So I added so codes in newSearcher where I found the warm up takes place. I add my codes before solr warm up which is configed in solrconfig.xml like this: <listener event="firstSearcher" class="solr.QuerySenderListener"> <arr name="queries"> ... </arr> </listener>
public void newSearcher(SolrIndexSearcher newSearcher, SolrIndexSearcher currentSearcher) { warmTextCache(newSearcher,warmTextCache,new String[]{"title","content"}); for (NamedList nlst : (List<NamedList>)args.get("queries")) { } } in warmTextCache I need a reader to get some docs for(int i=0;i<reader.maxDoc();i++){ if(reader.isDeleted(i)) continue; Document doc=reader.document(i); String fullText=doc.get("content"); cache.put(i,fullText); } So I need a reader, When I contruct a reader by myself like: IndexReader reader=IndexReader.open(...); Or by core.getSearcher().get().getReader() Then it will be very slow when I send a query after warm up I used jstack and found all of the requests are blocked in SolrCore line 1000 searcherLock.wait(); // check to see if we can wait for someone else's searcher to be set if (onDeckSearchers>0 && !forceNew && _searcher==null) { try { Line 1000 searcherLock.wait(); } catch (InterruptedException e) { log.info(SolrException.toStr(e)); } } And about 5 minutes later. it's ok. So How can I get a "safe" reader in this situation?