NOT queries

2006-11-21 Thread Antony Bowesman
Hi, I'm writing a mapping mechanism between an existing search interface and Lucene and wondered how to support a single NOT/- query. Given the query "-attribute", then from an ealier comment by Chris Hostetter where he says "you can't have a negative clause in isolation by itself", I assume

Re: NOT queries

2006-11-21 Thread Daniel Noll
Antony Bowesman wrote: Hi, I'm writing a mapping mechanism between an existing search interface and Lucene and wondered how to support a single NOT/- query. Given the query "-attribute", then from an ealier comment by Chris Hostetter where he says "you can't have a negative clause in isolati

Re: NOT queries

2006-11-21 Thread Daniel Naber
On Tuesday 21 November 2006 23:14, Antony Bowesman wrote: > I > assume that you first have to create a BooleanClause that finds > everything and then another Clause that removes the "attribute". > > Is this right or is there another way to do it? That's correct. For the "find everything" part yo

Re: NOT queries

2006-11-21 Thread Antony Bowesman
Daniel Naber wrote: That's correct. For the "find everything" part you can use MatchAllDocsQuery. Thanks - I hadn't noticed that Query. Antony - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMA

Using NOT queries inside parentheses

2006-03-06 Thread Satuluri, Venu_Madhav
Hi, The following query does not work as expected for me: "alwaysTrueField:true (-name:john)" neither does this: "alwaysTrueField:true +(-name:john)" It returns zero results, despite there being many documents without name john. (alwaysTrueField is, needless to say, true for all documents). This

Re: Using NOT queries inside parentheses

2006-03-06 Thread Chris Hostetter
: The following query does not work as expected for me: : "alwaysTrueField:true (-name:john)" : neither does this: : "alwaysTrueField:true +(-name:john)" : Does lucene run a sub-query for each part of the query inside : parentheses, which is why the NOT query that is alone doesn't work? I am Bas

Re: Using NOT queries inside parentheses

2006-03-06 Thread Daniel Noll
Satuluri, Venu_Madhav wrote: Hi, The following query does not work as expected for me: "alwaysTrueField:true (-name:john)" neither does this: "alwaysTrueField:true +(-name:john)" It returns zero results, despite there being many documents without name john. (alwaysTrueField is, needless to say,

RE: Using NOT queries inside parentheses

2006-03-07 Thread Satuluri, Venu_Madhav
> Query at = new TermQuery(new Term("alwaysTrueField","true)); > Query user = queryParser.parse(userInput); > if (user instanceof BooleanQuery) { > BooleanQuery bq = (BooleanQuery)user; > if (! usableBooleanQuery(bq)) { > bq.add(at, true, false); /* add 'always true' clause

Re: Using NOT queries inside parentheses

2006-03-07 Thread Daniel Noll
Satuluri, Venu_Madhav wrote: If you want this to work, the most elegant way I've found is to override the getBooleanQuery(Vector) method in QueryParser and insert a MatchAllDocsQuery into the boolean query if every clause is prohibited. Daniel I tried this, but it looks like the overridden