The API I'm working with combines a series of queries into one larger one using a boolean query.
Queries on the same field get OR's into one big query. All remaining queries are AND'd with this big one. Working with in this system I have: arg = (mario luigi bobby joe) //i do have control of how this list is created I pass this to the QueryParser: Query query1 = QueryParser.parse(arg, "name", new StandardAnalyzer()); Query query2 = QueryParser.parse("stillhere", "olfaithfull", new StandardAnalyzer()); BooleanQuery typeNegativeSearch = new BooleanQuery(); typeNegativeSearch.add(query1, false, true); typeNegativeSearch.add(query2, true, false); This is half the query. It gets AND'd with the other half, to create what you see below: +(type:181) +((-(name:tim name:harry name:bill) +olfaithfull:stillhere)) What I am having trouble with is getting the QueryParser to create this: -name:(tim bill harry) I feel like this is something simple, but for some reason I can't figure it out. Thanks, Luke ----- Original Message ----- From: "Todd VanderVeen" <[EMAIL PROTECTED]> To: "Lucene Users List" <lucene-user@jakarta.apache.org> Sent: Monday, February 21, 2005 5:33 PM Subject: Re: Optional Terms in a single query > Luke Shannon wrote: > > >Hi; > > > >I'm trying to create a query that look for a field containing type:181 and > >name doesn't contain tim, bill or harry. > > > >+(type: 181) +((-name: tim -name:bill -name:harry +oldfaith:stillHere)) > >+(type: 181) +((-name: tim OR bill OR harry +oldfaith:stillHere)) > >+(type: 181) +((-name:*(tim bill harry)* +olfaithfull:stillhere)) > >+(type:1 81) +((-name:*(tim OR bill OR harry)* +olfaithfull:stillhere)) > > > >I would really think to do this all in one Query. Is this even possible? > > > >Thanks, > > > >Luke > > > > > > > >--------------------------------------------------------------------- > >To unsubscribe, e-mail: [EMAIL PROTECTED] > >For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > All all the queries listed attempts at the same things? > > I'm guessing you want this: > > +type:181 -name:(tim bill harry) +oldfaith:stillHere > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]