Thanks again Daniel,

It's working now. But for some reason, TermQuery is not working for me (i
think because I have special characters in the query). I replaced the
TermQuery with the query below and I got the results I was expecting.

Thanks!!!!

String escapedType = QueryParser.escape(type);
QueryParser parser = new QueryParser(TYPE_FIELD, ANALYZER);
Query tq = parser.parse(TYPE_FIELD + ":" + escapedType);


Andre

On Tue, Aug 26, 2008 at 10:19 AM, Daniel Naber <
[EMAIL PROTECTED]> wrote:

> On Dienstag, 26. August 2008, Andre Rubin wrote:
>
> > Now I was the one who didn't follow: How do I add a query to an existing
> > query?
>
> Something like this should work:
>
> BooleanQuery bq = new BooleanQuery();
> PrefixQuery pq = new PrefixQuery(...);
> bq.add(pq, BooleanClause.Occur.MUST);
> TermQuery tq = new TermQuery(new Term("type", "sequence"));
> bq.add(tq, BooleanClause.Occur.MUST);
>
> bq is now the query you can use for searching. BooleanClause.Occur.MUST
> basically means "AND". So unless you want your users to access the
> features of Lucene's QueryParser (e.g. AND, OR, NOT, fuzzy queries etc)
> there's no need to use it.
>
> Regards
>  Daniel
>
> --
> http://www.danielnaber.de
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to