lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Hatcher <e...@ehatchersolutions.com>
Subject Re: how to store and reuse query
Date Sat, 03 Feb 2007 00:44:24 GMT

On Feb 2, 2007, at 1:02 PM, Ng Vinny wrote:
> After processing some text, I have constructed a Boolean query , e.g.
> "title:Lucene author:Otis", and I would like to store the query to  
> reuse
> when the same piece of text is issued (to avoid re-processing of  
> the same
> text).

Solr (can't help but point to it) does query result DocSet/List  
caching, which dramatically speeds up requests for the same query or  
successive pages of the same query [couple that with the filter query  
and facet query capability... wow!].  You could cache (bits of) the  
results of a query and key it by the query expression.  This  
obviously has merit, but whether you need to go that far for your  
needs or not depend on the scale.

> I thought of storing the string resulted from Query.toString()  
> method, but
> there is no constructor of Query to build a new Query from the  
> string I
> retrieve from the datastore.

The Query.toString() output is QueryParser-like.  Generally speaking  
you can .toString() a query and QueryParser it and you'll have the  
same query.  But, this may not always be the case.  A rewritten Query  
can be different, and also I wouldn't bank on the fact that all the  
Query subclasses have kept QueryParser roundtripping compliance.  
Maybe, but I'd be surprised if there weren't some exceptions.

	Erik


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message