Hallo Robert, > This is why I think for many users the field cache is not the best > solution. If you have lots of documents but searchers that return > relatively few, then using filters and sorting the results using > stored fields is far more efficient. > > It seems to me that the field cache is only appropriate when the > documents have very few fields in play (1-3 ?), otherwise cached > range filters will work better. If we also have partitioned (trie > query) and compressed filters, then the cache is only useful for > sorting.
I was all the time thinking about it. Maybe we should write a wiki page on the different RangeQueries and Caches. It is very hard to find the right solution. Currently you have three possibilities: A) use TrieRangeQuery without any cache, this works fast and affects only a almost constant number (with upper limit) of terms (even when the range is very large, half open, etc.) and may returns many documents. This is my preferred solution for floating point ranges and ranges with lot's of different values. TrieRangeQuery can be tuned by using the CachingFilter (that caches the BitSet). The FieldCache is of no use for this query type. I recommend this type also for often changing indexes, because no FieldCache needs to be refilled on index change. B) use FieldCacheRangeFilter. This needs the initial filling of the filter and needs more memory. The pros of this Filter is that it may completely work in memory and reuses the cache used for searching, but its query time still largely depends largely on the number of documents in index (you have to iterate over the field cache during the search). This may be optimized by binary searches etc, but this would only be good, if the field cache would be sorted by values and not by document numbers. > The most important use for the field cache seems to be the case where > a query returns lots of documents, say by date range, AND you want > the most recent ones to score higher (needing the sort) - basically > using the cache for the selection and the sort. Correct. I think we should create a wiki page comparing the different Range approaches. There are many combinations of FieldCache, Trie structures, RangeFilters and caches. Uwe --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]