- Renamed a few recently added variables and methods for consistency.

git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@149805 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Otis Gospodnetic 2002-07-14 17:21:57 +00:00
parent ea4c15138e
commit 4f9dc49cfb
1 changed files with 12 additions and 11 deletions

View File

@ -159,25 +159,26 @@ public class QueryParser {
// CODE ADDED BY PETER HALACSY
/** The actual mode that parses uses to parse queries */
public static final int DEFAULT_OPERATOR_OR = 0;
public static final int DEFAULT_OPERATOR_AND = 1;
private int mode = DEFAULT_OPERATOR_OR;
/** The actual operator that parser uses to combine query terms */
private int operator = DEFAULT_OPERATOR_OR;
/**
* Set the mode of the QueryParser. In classic mode (<code>DEFAULT_OPERATOR_OR</mode>)
* term without any modifiers are considered optional: for example <code>
* capital of Hungary</code> is equal to <code>capital OR of OR Hungary</code>.<br/>
* Set the boolean operator of the QueryParser.
* In classic mode (<code>DEFAULT_OPERATOR_OR</mode>) terms without any modifiers
* are considered optional: for example <code>capital of Hungary</code> is equal to
* <code>capital OR of OR Hungary</code>.<br/>
* In <code>DEFAULT_OPERATOR_AND</code> terms are considered to be in conjuction: the
* above mentioned query is parsed as <code>capital AND of AND Hungary</code>
*/
public void setMode(int mode) {
this.mode = mode;
public void setOperator(int operaror) {
this.operator = operator;
}
public int getMode() {
return this.mode;
public int getOperator() {
return this.operator;
}
private void addClause(Vector clauses, int conj, int mods, Query q) {
@ -191,7 +192,7 @@ public class QueryParser {
c.required = true;
}
// THIS CODE ADDED PETER HALACSY
if(mode == DEFAULT_OPERATOR_AND && conj == CONJ_OR) {
if (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
@ -207,7 +208,7 @@ public class QueryParser {
if (q == null)
return;
if(mode == DEFAULT_OPERATOR_OR) {
if (operator == DEFAULT_OPERATOR_OR) {
// THIS IS THE ORIGINAL CODE
// We set REQUIRED if we're introduced by AND or +; PROHIBITED if
// introduced by NOT or -; make sure not to set both.