lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erick Erickson <erickerick...@gmail.com>
Subject Re: Query about Query.ToString()
Date Wed, 17 Feb 2010 18:55:32 GMT
Well, Query *does* implement the Serializable interface, so that
might work. WARNING: I haven't personally used the Serializable
interface on Query, so I have no real clue whether it's applicable!

Taking the results of query.toString() and pumping it back through
the parser is not guaranteed to produce an equivalent query though.

But if you're creating a library of queries, why not just code up the
queries
as strings and store/reuse those?

I'd think about forming a query that I can send through the query parsing,
then storing that string for later reuse (i.e. the string you parsed). This
has
problems if you're constructing the query programatically (say assembling
a BooleanQuery in the lucene code) though.

not much help I know
Erick


On Wed, Feb 17, 2010 at 1:44 PM, Aaron Schon <aaron_schon@yahoo.com> wrote:

> Hi all, I know that persisting a Lucene query by query ToString() method.
> Is there any way of reconstructing the query from the string itself?
> The usecase is that I will be storing a library of queries as strings and
> load the appropriate query (from the string) based on some conditions.
>
> Is this possible? Could you share a code snippet?
>
> p.s. apologies for the double posting (I had asked this on Lucene general
> and was asked to ask here instead)
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message