Query.toString() and QueryParser.parse()

2007-08-22 Thread loesh
Hi, I am wondering if QueryParser.parse(...) is supposed to be able to 
recreate any given query using something like:


Query query = //creating query somehow.
Queryparser qp = //creatign a query parser

String queryString = query.toString();

Query parsed = qp.parse(queryString);
String parsedString = parsed.toString();

boolean equals = parsedString().equals(queryString);

Maybe not the clearest of questions. but should "equals" in the above 
example allways be true for any Query?


Sincerley,
Fredrik Ståhl


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Query.toString() and QueryParser.parse()

2007-08-22 Thread loesh

Erik Hatcher wrote:


On Aug 22, 2007, at 6:34 AM, loesh wrote:

Query parsed = qp.parse(queryString);
String parsedString = parsed.toString();

boolean equals = parsedString().equals(queryString);

Maybe not the clearest of questions. but should "equals" in the above 
example allways be true for any Query?


No, that never has been a design goal of Query.toString(), and there 
many cases that it fails.  QueryParser only supports a fraction of the 
Query subclasses out there, so any Query subclass it does not support, 
of course, will fail to parse as you're expecting.


I understand the benefit such a feature would have, though.

Erik


Ok, thanks for the fast reply. I kind of figured it was not supposed to 
be that way but it would have some benefits.



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]