I have an index with several fields, but just one stored: ID (string, unique). I need to access that ID field for each of the tops "nodes" docs in my results (this is done inside a handler I wrote), code looks like:
Hits hits = searcher.search(query); for(int i=0; i<nodes; i++) { id[i]=hits.doc(i).get("ID"); score[i]=hits.score(i); } I noticed that retrieving the code is slow. if I use the FieldCache, like: id[i]=FieldCache.DEFAULT.getStrings(searcher.getReader(), "ID")[hits.id(i)]; after the first execution (the initialization of the cache take some times), it seems to run much faster. But what happens when SOLR reload the index (after a commit, or an optimize for example)? Will it refresh the cache with new reader (in the warmup process?), or it will be the first query execution of that code (with the new reader) that will force the refresh? (this could mean that every first query after a reload will be slower) Is there any way to tell SOLR to cache and warmup when needed this "ID" field? Thanks, Walter