On Saturday 15 December 2007 20:48:38 Yonik Seeley wrote: > On Dec 15, 2007 2:23 PM, Timo Nentwig <[EMAIL PROTECTED]> wrote: > > On Saturday 15 December 2007 00:17:10 Chris Hostetter wrote: > > > : Actually FuzzyQuery.rewrite() is pretty expensive so why not > > > : introduce a caching decorator? A WeakHashMap with key==IndexReader > > > : and value==LRU of BooleanQueries. > > > > > > Applications are certainly welcome to do this (there is nothing to stop > > > you from calling rewrite before passing the query to your Searcher, i > > > believe the overhead of calling rewrite on a query that's already been > > > rewritten is fairly low) but I don't think it would be a good idea to > > > add > > > > Why should subsequent rewrites be faster? > > Hoss means calling rewrite on the *result* of a rewrite.
Uh? That's what I mean (propose), too... But currently nothing's cached at all. Cache the result (BooleanQuery) of rewrite() in a WeakHashMap with key = IndexReader and value = LRU. > So the application would call rewrite, cache the resulting query, and > then use that already rewritten query from then on. Lucene wouldn't > know it had already been rewritten, and would call rewrite again, but > it should be fast. > > -Yonik > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]