Thank you for all your good answers
The restriction i want to search with looks somethinks like this:
I want to do some searching for A in diffenerent Fields and i want to
prohibite some user/usergroups specific field values. I am right to do
it in this way:
BooleanQuery q1 = new BooleanQuery();
q1.add(new TermQuery(new Term("field", "B"), false, true);
q1.add(new TermQuery(new Term("field", "C"), false, true);
...
q2 = new BooleanQuery();
q2.add(new TermQuery(new Term("field", "A"), true, false);
q2.add(q1, false, true);
Or is there an better way to prohibite something? Filters maybe? Anyone
a short example how to implement a lucene filter?
Thanks a lot, Thomas
Michael D. Curtin schrieb:
Volodymyr Bychkoviak wrote:
This is not the case.
maxClauseCount limit number of terms that can fit into BooleanQuery
during some queries rewriting. And default value is 1024, not 32.
32 required/prohibited clauses is limitation of Lucene 1.4.3 due to
usage of bit patterns to mask required/prohibited clauses.
You can solve this problem by using Lucene 1.9 RC or use Filters.
Doh! Wrong Exception. Volodymyr is right.
Thomas, what do your extra clauses look like? Can they be combined in
sub-clauses, as it were? For example, if you want hits with A,
subject to the restrictions that they don't have B, nor C, ..., you
might be able to use a query construct like
+A -(B || C || ...)
The components of the B || C || ... part aren't required nor
prohibited, so you wouldn't run up against the 32 limit (you might hit
the 1024 limit, but then you now know how to increase that). If
you're constructing the Query yourself (not via the QueryParser), then
something like this:
BooleanQuery q1 = new BooleanQuery();
q1.add(new TermQuery(new Term("field", "B"), false, false);
q1.add(new TermQuery(new Term("field", "C"), false, false);
...
q2 = new BooleanQuery();
q2.add(new TermQuery(new Term("field", "A"), true, false);
q2.add(q1, false, true);
// Use q2 for searching
Note also that you could substitute any Query-derived object for the
new TermQuery()s in q1. If you need to add restrictions more
complicated than a single value of a single field, build up another
Query-derived object for that restriction, and put it into q1 instead.
Good luck! (And sorry about the misdirection)
--MDC
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]