> 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 directly
*/
> return bq;
> }
> }
> /* if we made it here, wrape both clauses.
> BooleanQuery q = new BooleanQuery();
> q.add(at, true, false);
> q.add(user, true, false);
> return q;
Many thanks, Chris, its working for me perfectly.
> 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 method
getBooleanQuery(vector) does not get called. I am using 1.4.3.
Thanks,
Venu
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]