1 package org.apache.lucene.queryParser.core.nodes;
4 * Licensed to the Apache Software Foundation (ASF) under one or more
5 * contributor license agreements. See the NOTICE file distributed with
6 * this work for additional information regarding copyright ownership.
7 * The ASF licenses this file to You under the Apache License, Version 2.0
8 * (the "License"); you may not use this file except in compliance with
9 * the License. You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
20 import org.apache.lucene.queryParser.core.parser.EscapeQuerySyntax;
23 * A {@link ParametricQueryNode} represents LE, LT, GE, GT, EQ, NE query.
24 * Example: date >= "2009-10-10" OR price = 200
26 * @deprecated this class will be removed in future. {@link FieldQueryNode}
27 * should be used instead.
30 public class ParametricQueryNode extends FieldQueryNode {
32 private static final long serialVersionUID = -5770038129741218116L;
34 private CompareOperator operator;
36 public enum CompareOperator {
39 public String toString() { return "<="; }
43 public String toString() { return "<"; }
47 public String toString() { return ">="; }
51 public String toString() { return ">"; }
55 public String toString() { return "="; }
59 public String toString() { return "!="; }
71 * - position in the query string
73 * - position in the query string
75 public ParametricQueryNode(CharSequence field, CompareOperator comp,
76 CharSequence value, int begin, int end) {
77 super(field, value, begin, end);
82 public CharSequence getOperand() {
87 public CharSequence toQueryString(EscapeQuerySyntax escapeSyntaxParser) {
88 return this.field + "" + this.operator.toString() + "\"" + this.text + "\"";
92 public String toString() {
93 return "<parametric field='" + this.field + "' operator='"
94 + this.operator.toString() + "' text='" + this.text + "'/>";
98 public ParametricQueryNode cloneTree() throws CloneNotSupportedException {
99 ParametricQueryNode clone = (ParametricQueryNode) super.cloneTree();
101 clone.operator = this.operator;
107 * @return the operator
109 public CompareOperator getOperator() {
110 return this.operator;