Re: Memory problem with TermQuery

2015-06-08 Thread Alan Woodward
You'll still need to call rewrite, but it needs to be done per-reader, so you'll need to cache the queries *before* they're rewritten, and then call rewrite whenever you create a new IndexReader. Otherwise you'll get incorrect scores, and possibly missed hits as well. Alan Woodward www.flax.co

RE: Memory problem with TermQuery

2015-06-08 Thread Anna Maier
Hi Alan, you are right, we are calling rewrite on our query at some point. Ok, it would probably be an option to take that out. Thanks for the hint! Best, Anna -Original Message- From: Alan Woodward [mailto:a...@flax.co.uk] Sent: Montag, 8. Juni 2015 12:23 To: java-user@lucene.apache.o

Re: Memory problem with TermQuery

2015-06-08 Thread Alan Woodward
Hi Anna, In normal usage, perReaderTermState will be null, and TermQuery will be very lightweight. It's in particular expert use cases (generally after queries have been rewritten against a specific IndexReader) that the perReaderTermState will be initialized. Are you cacheing rewritten queri

Memory problem with TermQuery

2015-06-08 Thread Anna Maier
Hi, we ran into a memory problem with TermQuery: in our program, we build a TermQuery object from the user input and pass it around, to be able to different things, like execute the query again and so on. So, the TermQuery object can potentially exist for some time. Now it turns out, that a Ter