This is a great explanation, thanks. I'm going to add it to the wiki somewhere that seems relevant, if no-one minds and the wiki lets me. ________________________________________ From: Chris Hostetter [hossman_luc...@fucit.org] Sent: Thursday, October 28, 2010 7:27 PM To: solr-user@lucene.apache.org Subject: Re: documentCache clarification
: the documentCache: "(Note: This cache cannot be used as a source for : autowarming because document IDs will change when anything in the : index changes so they can't be used by a new searcher.)" : : Can anyone elaborate a bit on that. I think I've read it at least 10 : times and I'm still unable to draw a mental picture. I'm wondering if : the document IDs referred to are the ones I'm defining in my schema, : or are they the underlying lucene ids, i.e. the ones that, according : to the Lucene in Action book, are "relative within each segment"? they are the underlying lucene docIds that change as segments are merged. : queryResultCache. However, if I issue a request with rows=10, I will : get an insert, and then a later request for rows=500 would re-use and : update that original cached docList object. Right? And would it be : updated with the full list of 500 ordered doc ids or only 200? note quite. The queryResultCache is keyed on <Query,Sort,Start,Rows,Filters> and the value is a "DocList" object ... http://lucene.apache.org/solr/api/org/apache/solr/search/DocList.html Unlike the Document objects in the documentCache, the DocLists in the queryResultCache never get modified (techincally Solr doesn't actually modify the Documents either, the Document just keeps track of it's fields and updates itself as Lazy Load fields are needed) if a DocList containing results 0-10 is put in the cache, it's not going to be of any use for a query with start=50. but if it contains 0-50 it *can* be used if start < 50 and rows < 50 -- that's where the queryResultWindowSize comes in. if you use start=0&rows=10, but your window size is 50, SolrIndexSearcher will (under the covers) use start=0&rows=50 and put that in the cache, returning a "slice" from 0-10 for your query. the next query asking for 10-20 will be a cache hit. -Hoss