Home » lucene-3.0.1-src » org.apache » lucene » xmlparser » [javadoc | source]

    1   package org.apache.lucene.xmlparser;
    2   
    3   import org.apache.lucene.analysis.Analyzer;
    4   import org.apache.lucene.queryParser.QueryParser;
    5   import org.apache.lucene.xmlparser.builders.BooleanFilterBuilder;
    6   import org.apache.lucene.xmlparser.builders.BoostingQueryBuilder;
    7   import org.apache.lucene.xmlparser.builders.DuplicateFilterBuilder;
    8   import org.apache.lucene.xmlparser.builders.FuzzyLikeThisQueryBuilder;
    9   import org.apache.lucene.xmlparser.builders.LikeThisQueryBuilder;
   10   import org.apache.lucene.xmlparser.builders.TermsFilterBuilder;
   11   /**
   12    * Licensed to the Apache Software Foundation (ASF) under one or more
   13    * contributor license agreements.  See the NOTICE file distributed with
   14    * this work for additional information regarding copyright ownership.
   15    * The ASF licenses this file to You under the Apache License, Version 2.0
   16    * (the "License"); you may not use this file except in compliance with
   17    * the License.  You may obtain a copy of the License at
   18    *
   19    *     http://www.apache.org/licenses/LICENSE-2.0
   20    *
   21    * Unless required by applicable law or agreed to in writing, software
   22    * distributed under the License is distributed on an "AS IS" BASIS,
   23    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   24    * See the License for the specific language governing permissions and
   25    * limitations under the License.
   26    */
   27   
   28   /**
   29    * 
   30    */
   31   public class CorePlusExtensionsParser extends CoreParser
   32   {
   33   
   34   	/**
   35   	 * Construct an XML parser that uses a single instance QueryParser for handling 
   36   	 * UserQuery tags - all parse operations are synchronized on this parser
   37   	 * @param analyzer
   38   	 * @param parser A QueryParser which will be synchronized on during parse calls.
   39   	 */
   40   	public CorePlusExtensionsParser(Analyzer analyzer, QueryParser parser)
   41   	{
   42   		this(null,analyzer, parser);
   43   	}
   44   	/**
   45   	 * Constructs an XML parser that creates a QueryParser for each UserQuery request.
   46   	 * @param defaultField The default field name used by QueryParsers constructed for UserQuery tags 
   47   	 * @param analyzer 
   48   	 */
   49   	public CorePlusExtensionsParser(String defaultField,Analyzer analyzer)
   50   	{
   51   		this(defaultField,analyzer, null);
   52   	}
   53   
   54   	private CorePlusExtensionsParser(String defaultField,Analyzer analyzer, QueryParser parser)
   55   	{
   56   		super(defaultField,analyzer, parser);
   57   		filterFactory.addBuilder("TermsFilter",new TermsFilterBuilder(analyzer));
   58   		filterFactory.addBuilder("BooleanFilter",new BooleanFilterBuilder(filterFactory));
   59   		filterFactory.addBuilder("DuplicateFilter",new DuplicateFilterBuilder());
   60   		String fields[]={"contents"};
   61   		queryFactory.addBuilder("LikeThisQuery",new LikeThisQueryBuilder(analyzer,fields));
   62   		queryFactory.addBuilder("BoostingQuery", new BoostingQueryBuilder(queryFactory));
   63   		queryFactory.addBuilder("FuzzyLikeThisQuery", new FuzzyLikeThisQueryBuilder(analyzer));
   64   		
   65   	}
   66   }

Home » lucene-3.0.1-src » org.apache » lucene » xmlparser » [javadoc | source]