1 package org.apache.lucene.queryParser.core.processors;
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.QueryNodeException;
21 import org.apache.lucene.queryParser.core.config.QueryConfigHandler;
22 import org.apache.lucene.queryParser.core.nodes.QueryNode;
26 * A {@link QueryNodeProcessor} is an interface for classes that process a
27 * {@link QueryNode} tree.
30 * The implementor of this class should perform some operation on a query node
31 * tree and return the same or another query node tree.
34 * It also may carry a {@link QueryConfigHandler} object that contains
35 * configuration about the query represented by the query tree or the
36 * collection/index where it's intended to be executed.
39 * In case there is any {@link QueryConfigHandler} associated to the query tree
40 * to be processed, it should be set using
41 * {@link QueryNodeProcessor#setQueryConfigHandler(QueryConfigHandler)} before
42 * {@link QueryNodeProcessor#process(QueryNode)} is invoked.
45 * @see QueryNodeProcessor
46 * @see QueryConfigHandler
48 public interface QueryNodeProcessor {
51 * Processes a query node tree. It may return the same or another query tree.
52 * I should never return <code>null</code>.
57 * @return the processed query tree
59 * @throws QueryNodeException
61 public QueryNode process(QueryNode queryTree) throws QueryNodeException;
64 * Sets the {@link QueryConfigHandler} associated to the query tree.
66 * @param queryConfigHandler
68 public void setQueryConfigHandler(QueryConfigHandler queryConfigHandler);
71 * Returns the {@link QueryConfigHandler} associated to the query tree if any,
72 * otherwise it returns <code>null</code>
74 * @return the {@link QueryConfigHandler} associated to the query tree if any,
75 * otherwise it returns <code>null</code>
77 public QueryConfigHandler getQueryConfigHandler();