lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Hostetter <>
Subject Re: Query rewriting - caching rewritten quries
Date Wed, 02 Jul 2014 21:10:09 GMT
: In the system which I develop I have to store many query objects in memory.
: The system also receives documents. For each document MemoryIndex is
: instantiated. I execute all stored queries on this MemoryIndex. I realized
: that searching over MemoryIndex takes much time for query rewriting. I'm
: wondering if I can cache rewritten queries to avoid still rewritting. Is
: there any way to do it?

it depends on what you want to do with the cached queries.

the rewritten queries are relative to the IndexReader passed to the 
rewrite() method -- you can't re-use them against a new/different 
IndexReader (not even if it's a reopened reader against the same index)

from a memory standpoint, rewritten queries also tend to be larger then 
the original query (due to term expansion) so even if you plan on using 
these cached queries over and over against hte same IndexReader 
(allthough: there's not much point of that -- you might as wel ust cache 
the results instead) you're trading the time needed for rewrite() against 
the the memory needed for the cache.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message