final public QueryNode Term(CharSequence field) throws ParseException {
Token term, boost=null, fuzzySlop=null, goop1, goop2;
boolean fuzzy = false;
QueryNode q =null;
ParametricQueryNode qLower, qUpper;
float defaultMinSimilarity = 0.5f;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case TERM:
case NUMBER:
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case TERM:
term = jj_consume_token(TERM);
q = new FieldQueryNode(field, EscapeQuerySyntaxImpl.discardEscapeChar(term.image), term.beginColumn, term.endColumn);
break;
case NUMBER:
term = jj_consume_token(NUMBER);
break;
default:
jj_la1[9] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case FUZZY_SLOP:
fuzzySlop = jj_consume_token(FUZZY_SLOP);
fuzzy=true;
break;
default:
jj_la1[10] = jj_gen;
;
}
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case CARAT:
jj_consume_token(CARAT);
boost = jj_consume_token(NUMBER);
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case FUZZY_SLOP:
fuzzySlop = jj_consume_token(FUZZY_SLOP);
fuzzy=true;
break;
default:
jj_la1[11] = jj_gen;
;
}
break;
default:
jj_la1[12] = jj_gen;
;
}
if (fuzzy) {
float fms = defaultMinSimilarity;
try {
fms = Float.valueOf(fuzzySlop.image.substring(1)).floatValue();
} catch (Exception ignored) { }
if(fms < 0.0f || fms > 1.0f){
{if (true) throw new ParseException(new MessageImpl(QueryParserMessages.INVALID_SYNTAX_FUZZY_LIMITS));}
}
q = new FuzzyQueryNode(field, EscapeQuerySyntaxImpl.discardEscapeChar(term.image), fms, term.beginColumn, term.endColumn);
}
break;
case RANGEIN_START:
jj_consume_token(RANGEIN_START);
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case RANGEIN_GOOP:
goop1 = jj_consume_token(RANGEIN_GOOP);
break;
case RANGEIN_QUOTED:
goop1 = jj_consume_token(RANGEIN_QUOTED);
break;
default:
jj_la1[13] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case RANGEIN_TO:
jj_consume_token(RANGEIN_TO);
break;
default:
jj_la1[14] = jj_gen;
;
}
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case RANGEIN_GOOP:
goop2 = jj_consume_token(RANGEIN_GOOP);
break;
case RANGEIN_QUOTED:
goop2 = jj_consume_token(RANGEIN_QUOTED);
break;
default:
jj_la1[15] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
jj_consume_token(RANGEIN_END);
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case CARAT:
jj_consume_token(CARAT);
boost = jj_consume_token(NUMBER);
break;
default:
jj_la1[16] = jj_gen;
;
}
if (goop1.kind == RANGEIN_QUOTED) {
goop1.image = goop1.image.substring(1, goop1.image.length()-1);
}
if (goop2.kind == RANGEIN_QUOTED) {
goop2.image = goop2.image.substring(1, goop2.image.length()-1);
}
qLower = new ParametricQueryNode(field, ParametricQueryNode.CompareOperator.GE,
EscapeQuerySyntaxImpl.discardEscapeChar(goop1.image), goop1.beginColumn, goop1.endColumn);
qUpper = new ParametricQueryNode(field, ParametricQueryNode.CompareOperator.LE,
EscapeQuerySyntaxImpl.discardEscapeChar(goop2.image), goop2.beginColumn, goop2.endColumn);
q = new ParametricRangeQueryNode(qLower, qUpper);
break;
case RANGEEX_START:
jj_consume_token(RANGEEX_START);
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case RANGEEX_GOOP:
goop1 = jj_consume_token(RANGEEX_GOOP);
break;
case RANGEEX_QUOTED:
goop1 = jj_consume_token(RANGEEX_QUOTED);
break;
default:
jj_la1[17] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case RANGEEX_TO:
jj_consume_token(RANGEEX_TO);
break;
default:
jj_la1[18] = jj_gen;
;
}
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case RANGEEX_GOOP:
goop2 = jj_consume_token(RANGEEX_GOOP);
break;
case RANGEEX_QUOTED:
goop2 = jj_consume_token(RANGEEX_QUOTED);
break;
default:
jj_la1[19] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
jj_consume_token(RANGEEX_END);
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case CARAT:
jj_consume_token(CARAT);
boost = jj_consume_token(NUMBER);
break;
default:
jj_la1[20] = jj_gen;
;
}
if (goop1.kind == RANGEEX_QUOTED) {
goop1.image = goop1.image.substring(1, goop1.image.length()-1);
}
if (goop2.kind == RANGEEX_QUOTED) {
goop2.image = goop2.image.substring(1, goop2.image.length()-1);
}
qLower = new ParametricQueryNode(field, ParametricQueryNode.CompareOperator.GT,
EscapeQuerySyntaxImpl.discardEscapeChar(goop1.image), goop1.beginColumn, goop1.endColumn);
qUpper = new ParametricQueryNode(field, ParametricQueryNode.CompareOperator.LT,
EscapeQuerySyntaxImpl.discardEscapeChar(goop2.image), goop2.beginColumn, goop2.endColumn);
q = new ParametricRangeQueryNode(qLower, qUpper);
break;
case QUOTED:
term = jj_consume_token(QUOTED);