FAQ
Hi,

I'm trying to build my own query. I want to combine several TermQuery
+ 1 PrefixQuery in a BooleanQuery. The Code looks like this:
BooleanQuery bq = new BooleanQuery();

Term t = new Term("field", "");

t.createTerm("foo");
TermQuery tq = new TermQuery(t);
bq.add(tq, Occur.MUST);

t.createTerm("bar");
PrefixQuery pq = new PrefixQuery(t);
bq.add(pq, Occur.MUST);

So bq is my customized BooleanQuery. Searching with this query results
in 0 hits. But working with QueryParser.parse()
and the parameter "foo AND bar*" results in a high number of hits.
Looking at the query string shows the same result
for the QueryParser querystring and the customized BooleanQuery
querystring.
What could be the problem with my customized query?

Sascha

Search Discussions

Discussion Posts

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 2 | next ›
Discussion Overview
groupjava-user @
categorieslucene
postedJun 16, '08 at 8:26a
activeJun 16, '08 at 1:12p
posts2
users2
websitelucene.apache.org

2 users in discussion

Sascha Fahl: 1 post Erick Erickson: 1 post

People

Translate

site design / logo © 2022 Grokbase