lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jack Krupansky" <>
Subject Re: Query serialization/deserialization
Date Sun, 28 Jul 2013 14:54:56 GMT
Yeah, it's a shame such a ser/deser feature isn't available in Lucene.

My idea is to have a separate module that the Query classes can delegate to 
for serialization and deserialization, handling recursion for nested query 
objects, and then have modules for XML, JSON, and a pseudo-Java functional 
notation (maybe closer to JavaScript) for the actual formatting and parser. 
And then developers can subclass the module to add any custom Query classes 
of their own.

A full JSON query ser/deser would be an especially nice additionto Solr, 
allowing direct access to all Lucene Query features even if they haven't 
been integrated into the higher level query parsers.

And maybe the format should have a flag for whether terms have been analyzed 
or not. Then, deserialization could optionally do analysis as well.

The Solr QueryParsing.toString method shows a purely external approach to 
serialization (I've done something similar myself.) This is what is output 
in the "parsedquery" section of debugQuery output for a Solr query response.

-- Jack Krupansky

-----Original Message----- 
From: Denis Bazhenov
Sent: Sunday, July 28, 2013 1:59 AM
Subject: Query serialization/deserialization

I'm looking for a tool to serialize and deserialize Lucene queries. We have 
tried using Query.toString(), but some queries return string that couldn't 
be parsed by a QueryParser afterwards. The alternative possibility is to use 
standard Java serialization mechanism. The reason I'm trying to avoid it, is 
that serialization is used to communicate in distributed system, and we 
can't guarantee the equality of Lucene version at all nodes at any 
particular point in time.

Is there some way to perform query serialization in "lucene version 
independent way"?
Denis Bazhenov <>

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

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

View raw message