@Override public CharSequence toQueryString(EscapeQuerySyntax escapeSyntaxParser) { if (isDefaultField(this.field)) { return getTermEscaped(escapeSyntaxParser); } else { return this.field + ":" + getTermEscaped(escapeSyntaxParser); } }
@Override public PrefixWildcardQueryNode cloneTree() throws CloneNotSupportedException { PrefixWildcardQueryNode clone = (PrefixWildcardQueryNode) super.cloneTree(); // nothing to do here return clone; } }
/** * Creates a {@link NumericQueryNode} object using the given field, * {@link Number} value and {@link NumberFormat} used to convert the value to * {@link String}. * * @param field the field associated with this query node * @param value the value hold by this node * @param numberFormat the {@link NumberFormat} used to convert the value to {@link String} */ public NumericQueryNode(CharSequence field, Number value, NumberFormat numberFormat) { super(); setNumberFormat(numberFormat); setField(field); setValue(value); }
@Override public CharSequence toQueryString(EscapeQuerySyntax escaper) { if (isDefaultField(this.field)) { return this.text; } else { return this.field + ":" + this.text; } }
@Override public CharSequence toQueryString(EscapeQuerySyntax escapeSyntaxParser) { return isDefaultField(field)? "/"+text+"/": field + ":/" + text + "/"; }
/** * Constructs a {@link TermRangeQueryNode} object using the given * {@link FieldQueryNode} as its bounds. * * @param lower the lower bound * @param upper the upper bound * @param lowerInclusive <code>true</code> if the lower bound is inclusive, otherwise, <code>false</code> * @param upperInclusive <code>true</code> if the upper bound is inclusive, otherwise, <code>false</code> */ public TermRangeQueryNode(FieldQueryNode lower, FieldQueryNode upper, boolean lowerInclusive, boolean upperInclusive) { setBounds(lower, upper, lowerInclusive, upperInclusive); }
/** * Constructs a {@link NumericRangeQueryNode} object using the given * {@link NumericQueryNode} as its bounds and {@link NumericConfig}. * * @param lower the lower bound * @param upper the upper bound * @param lowerInclusive <code>true</code> if the lower bound is inclusive, otherwise, <code>false</code> * @param upperInclusive <code>true</code> if the upper bound is inclusive, otherwise, <code>false</code> * @param numericConfig the {@link NumericConfig} that represents associated with the upper and lower bounds * * @see #setBounds(NumericQueryNode, NumericQueryNode, boolean, boolean, NumericConfig) */ public NumericRangeQueryNode(NumericQueryNode lower, NumericQueryNode upper, boolean lowerInclusive, boolean upperInclusive, NumericConfig numericConfig) throws QueryNodeException { setBounds(lower, upper, lowerInclusive, upperInclusive, numericConfig); }
/** * Returns the lower bound node. * * @return the lower bound node. */ @Override @SuppressWarnings("unchecked") public T getLowerBound() { return (T) getChildren().get(0); }
@Override public void setField(CharSequence fieldName) { List<QueryNode> children = getChildren(); if (children != null) { for (QueryNode child : children) { if (child instanceof FieldableNode) { ((FieldableNode) child).setField(fieldName); } } } }
/** * Creates a {@link NumericQueryNode} object using the given field, * {@link Number} value and {@link NumberFormat} used to convert the value to * {@link String}. * * @param field the field associated with this query node * @param value the value hold by this node * @param numberFormat the {@link NumberFormat} used to convert the value to {@link String} */ public NumericQueryNode(CharSequence field, Number value, NumberFormat numberFormat) { super(); setNumberFormat(numberFormat); setField(field); setValue(value); }
@Override public CharSequence toQueryString(EscapeQuerySyntax escapeSyntaxParser) { if (isDefaultField(this.field)) { return getTermEscaped(escapeSyntaxParser); } else { return this.field + ":" + getTermEscaped(escapeSyntaxParser); } }
@Override public PrefixWildcardQueryNode cloneTree() throws CloneNotSupportedException { PrefixWildcardQueryNode clone = (PrefixWildcardQueryNode) super.cloneTree(); // nothing to do here return clone; } }
@Override public CharSequence toQueryString(EscapeQuerySyntax escaper) { if (isDefaultField(this.field)) { return this.text; } else { return this.field + ":" + this.text; } }
@Override public CharSequence toQueryString(EscapeQuerySyntax escapeSyntaxParser) { return isDefaultField(field)? "/"+text+"/": field + ":/" + text + "/"; }
/** * Constructs a {@link TermRangeQueryNode} object using the given * {@link FieldQueryNode} as its bounds. * * @param lower the lower bound * @param upper the upper bound * @param lowerInclusive <code>true</code> if the lower bound is inclusive, otherwise, <code>false</code> * @param upperInclusive <code>true</code> if the upper bound is inclusive, otherwise, <code>false</code> */ public TermRangeQueryNode(FieldQueryNode lower, FieldQueryNode upper, boolean lowerInclusive, boolean upperInclusive) { setBounds(lower, upper, lowerInclusive, upperInclusive); }
/** * Constructs a {@link NumericRangeQueryNode} object using the given * {@link NumericQueryNode} as its bounds and {@link NumericConfig}. * * @param lower the lower bound * @param upper the upper bound * @param lowerInclusive <code>true</code> if the lower bound is inclusive, otherwise, <code>false</code> * @param upperInclusive <code>true</code> if the upper bound is inclusive, otherwise, <code>false</code> * @param numericConfig the {@link NumericConfig} that represents associated with the upper and lower bounds * * @see #setBounds(NumericQueryNode, NumericQueryNode, boolean, boolean, NumericConfig) */ public NumericRangeQueryNode(NumericQueryNode lower, NumericQueryNode upper, boolean lowerInclusive, boolean upperInclusive, NumericConfig numericConfig) throws QueryNodeException { setBounds(lower, upper, lowerInclusive, upperInclusive, numericConfig); }