fix for #33395: The deprecated constructor of BooleanClause does not set new state (patch provided by Paul Elschot, slightly modified)

git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@151252 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Daniel Naber 2005-02-03 23:35:26 +00:00
parent ab72513214
commit ecd4a7256d
1 changed files with 14 additions and 0 deletions

View File

@ -71,6 +71,20 @@ public class BooleanClause implements java.io.Serializable {
query = q;
required = r;
prohibited = p;
if (required) {
if (prohibited) {
// prohibited && required doesn't make sense, but we want the old behaviour:
occur = Occur.MUST_NOT;
} else {
occur = Occur.MUST;
}
} else {
if (prohibited) {
occur = Occur.MUST_NOT;
} else {
occur = Occur.SHOULD;
}
}
}
/** Constructs a BooleanClause.