01: package org.apache.lucene.xmlparser;
02:
03: import org.apache.lucene.analysis.Analyzer;
04: import org.apache.lucene.queryParser.QueryParser;
05: import org.apache.lucene.xmlparser.builders.BooleanFilterBuilder;
06: import org.apache.lucene.xmlparser.builders.BoostingQueryBuilder;
07: import org.apache.lucene.xmlparser.builders.DuplicateFilterBuilder;
08: import org.apache.lucene.xmlparser.builders.FuzzyLikeThisQueryBuilder;
09: import org.apache.lucene.xmlparser.builders.LikeThisQueryBuilder;
10: import org.apache.lucene.xmlparser.builders.TermsFilterBuilder;
11:
12: /**
13: * Licensed to the Apache Software Foundation (ASF) under one or more
14: * contributor license agreements. See the NOTICE file distributed with
15: * this work for additional information regarding copyright ownership.
16: * The ASF licenses this file to You under the Apache License, Version 2.0
17: * (the "License"); you may not use this file except in compliance with
18: * the License. You may obtain a copy of the License at
19: *
20: * http://www.apache.org/licenses/LICENSE-2.0
21: *
22: * Unless required by applicable law or agreed to in writing, software
23: * distributed under the License is distributed on an "AS IS" BASIS,
24: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
25: * See the License for the specific language governing permissions and
26: * limitations under the License.
27: */
28: public class CorePlusExtensionsParser extends CoreParser {
29:
30: public CorePlusExtensionsParser(Analyzer analyzer,
31: QueryParser parser) {
32: super (analyzer, parser);
33: filterFactory.addBuilder("TermsFilter", new TermsFilterBuilder(
34: analyzer));
35: filterFactory.addBuilder("BooleanFilter",
36: new BooleanFilterBuilder(filterFactory));
37: filterFactory.addBuilder("DuplicateFilter",
38: new DuplicateFilterBuilder());
39: String fields[] = { "contents" };
40: queryFactory.addBuilder("LikeThisQuery",
41: new LikeThisQueryBuilder(analyzer, fields));
42: queryFactory.addBuilder("BoostingQuery",
43: new BoostingQueryBuilder(queryFactory));
44: queryFactory.addBuilder("FuzzyLikeThisQuery",
45: new FuzzyLikeThisQueryBuilder(analyzer));
46:
47: }
48:
49: }
|