I want all queries, regardless of how they were created, to be converted back into a parsable expression resulting in the same Query when parsed again (ignoring any analyzer issues at this point). For a programmatically created BooleanQuery for "term1 OR term2", the toString method returns:
term1 term2
This, of course, when parsed again using AND as the default operator, completely changes the query.
My first proposal is to change BooleanQuery.toString() to always put " OR " between terms that are not required or prohibited. Any objections to this change?
My second proposal, and this relates to a custom query parser I'm working on, is to separate the conversion of a Query to a String completely from the Query class itself. I envision some type of abstract factory mechanism, with the default implementation being the existing (mostly QueryParser compatible) format. Query.toString() would delegate to the formatter factory. The formatting implementation would be pluggable to allow other custom query expression formats to be generated from any Query instance.
I haven't fleshed out the exact design yet - I'm soliciting ideas for this effort. Thoughts?
Thanks, Erik
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]