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