mirror of https://github.com/apache/lucene.git
Fix ArrayIndexOutOfBoundsExceptions
This patch is common to several patches for QueryParser see e.g. Bug 9110 and it cannot have any negative side effects. git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@150498 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
89d41cd8f1
commit
dfeed0220e
|
@ -177,13 +177,13 @@ public class QueryParser implements QueryParserConstants {
|
|||
|
||||
// If this term is introduced by AND, make the preceding term required,
|
||||
// unless it's already prohibited
|
||||
if (conj == CONJ_AND) {
|
||||
if (clauses.size() > 0 && conj == CONJ_AND) {
|
||||
BooleanClause c = (BooleanClause) clauses.elementAt(clauses.size()-1);
|
||||
if (!c.isProhibited())
|
||||
c.setOccur(BooleanClause.Occur.MUST);
|
||||
}
|
||||
|
||||
if (operator == DEFAULT_OPERATOR_AND && conj == CONJ_OR) {
|
||||
if (clauses.size() > 0 && operator == DEFAULT_OPERATOR_AND && conj == CONJ_OR) {
|
||||
// If this term is introduced by OR, make the preceding term optional,
|
||||
// unless it's prohibited (that means we leave -a OR b but +a OR b-->a OR b)
|
||||
// notice if the input is a OR b, first term is parsed as required; without
|
||||
|
|
|
@ -200,13 +200,13 @@ public class QueryParser {
|
|||
|
||||
// If this term is introduced by AND, make the preceding term required,
|
||||
// unless it's already prohibited
|
||||
if (conj == CONJ_AND) {
|
||||
if (clauses.size() > 0 && conj == CONJ_AND) {
|
||||
BooleanClause c = (BooleanClause) clauses.elementAt(clauses.size()-1);
|
||||
if (!c.isProhibited())
|
||||
c.setOccur(BooleanClause.Occur.MUST);
|
||||
}
|
||||
|
||||
if (operator == DEFAULT_OPERATOR_AND && conj == CONJ_OR) {
|
||||
if (clauses.size() > 0 && operator == DEFAULT_OPERATOR_AND && conj == CONJ_OR) {
|
||||
// If this term is introduced by OR, make the preceding term optional,
|
||||
// unless it's prohibited (that means we leave -a OR b but +a OR b-->a OR b)
|
||||
// notice if the input is a OR b, first term is parsed as required; without
|
||||
|
|
Loading…
Reference in New Issue