Another good option is the XML query parser. If you are using webservices to start your lucene query, then it is much better to create an XML representation of your query and send it through the web service (SOAP as DOM element passed to xml query parser or parse the REST request using the xml query parser). The XML query parser is a contrib package.
The important thing is: You should not create query strings programmatically. Normally query strings should only entered by users. If you want to have a special query structure, it is much better to build the query using java objects or use the xml query parser (e.g. if you look for a term, use TermQuery, for a phrase use PhraseQuery and so on). Here you have full control on created objects and query types. Furthermore, you cannot fail with wrong escaping. ----- Uwe Schindler H.-H.-Meier-Allee 63, D-28213 Bremen http://www.thetaphi.de eMail: [email protected] > -----Original Message----- > From: Ted Dunning [mailto:[email protected]] > Sent: Monday, July 27, 2009 6:01 PM > To: [email protected] > Subject: Re: Question on query > > The current Lucene query syntax is specified here: > http://lucene.apache.org/java/2_3_2/queryparsersyntax.html Note that use > of > ampersands instead of AND is not supported. > > You may want to write your own query parser. It is relatively easy to do. > Take a look at the current query parser for some examples. > > You might also like to look at the 2.9 release which (I believe) has a > package from IBM that makes query syntax much easier to change. > > On Mon, Jul 27, 2009 at 6:29 AM, stx_gentoo > <[email protected]>wrote: > > > > > NOTE: I've read the documentation....but I am still a little confused. > > > > I am passing some advanced queries to web service that is using lucene. > > > > Example: > > > > John AND Beth AND (Lucy OR Gary) AND NOT Frank AND NOT Paul > > > > I am want to use "John"&&"Beth"&&("Lucy"||"Gary")!"Frank"!"Paul" and a > few > > other variations of this when I pass the query, but no success. I have > no > > problems using single queries, like the documentation...but no luck on > > something more advanced. > > > > I am not familiar with Lucene at all, and I just found out that I need > to > > interface with service that uses it... > > > > Appreciate any assistance! > > -- > > View this message in context: > > http://www.nabble.com/Question-on-query-tp24680717p24680717.html > > Sent from the Lucene - General mailing list archive at Nabble.com. > > > > > > > -- > Ted Dunning, CTO > DeepDyve
