Package org.apache.lucene.queryParser.core.config

Examples of org.apache.lucene.queryParser.core.config.QueryConfigHandler


    AnalyzerAttribute attr = getQueryConfigHandler().getAttribute(AnalyzerAttribute.class);
    attr.setAnalyzer(analyzer);
  }
 
  public Analyzer getAnalyzer() {   
    QueryConfigHandler config = this.getQueryConfigHandler();

    if ( config.hasAttribute(AnalyzerAttribute.class)) {
      AnalyzerAttribute attr = config.getAttribute(AnalyzerAttribute.class);
      return attr.getAnalyzer();
    }

    return null;      
  }
View Full Code Here


    if (node instanceof FieldableNode &&
        (node.getParent() == null || !(node.getParent() instanceof FieldableNode))) {
     
      FieldableNode fieldNode = (FieldableNode) node;
      QueryConfigHandler config = getQueryConfigHandler();

      if (config != null) {
        FieldConfig fieldConfig = config.getFieldConfig(fieldNode.getField());

        if (fieldConfig != null && fieldConfig.hasAttribute(BoostAttribute.class)) {
          BoostAttribute boostAttr = fieldConfig.getAttribute(BoostAttribute.class);

          return new BoostQueryNode(node, boostAttr.getBoost());
View Full Code Here

    // convert the CharSequence into a QueryNode tree
    QueryNode queryTree = queryParser.parse("body:text", null);

    // create a config handler with a attribute used in
    // UniqueFieldQueryNodeProcessor
    QueryConfigHandler spanQueryConfigHandler = new SpansQueryConfigHandler();
    UniqueFieldAttribute uniqueFieldAtt = spanQueryConfigHandler
        .getAttribute(UniqueFieldAttribute.class);
    uniqueFieldAtt.setUniqueField("index");

    // set up the processor pipeline with the ConfigHandler
    // and create the pipeline for this simple demo
View Full Code Here

    // empty constructor
  }

  @Override
  public QueryNode process(QueryNode queryTree) throws QueryNodeException {
    QueryConfigHandler queryConfig = getQueryConfigHandler();

    if (queryConfig != null) {
      Integer defaultPhraseSlop = queryConfig.get(ConfigurationKeys.PHRASE_SLOP);
     
      if (defaultPhraseSlop != null) {
        this.defaultPhraseSlop = defaultPhraseSlop;

        return super.process(queryTree);
View Full Code Here

    // convert the CharSequence into a QueryNode tree
    QueryNode queryTree = queryParser.parse("body:text", null);

    // create a config handler with a attribute used in
    // UniqueFieldQueryNodeProcessor
    QueryConfigHandler spanQueryConfigHandler = new SpansQueryConfigHandler();
    spanQueryConfigHandler.set(SpansQueryConfigHandler.UNIQUE_FIELD, "index");

    // set up the processor pipeline with the ConfigHandler
    // and create the pipeline for this simple demo
    QueryNodeProcessorPipeline spanProcessorPipeline = new QueryNodeProcessorPipeline(
        spanQueryConfigHandler);
View Full Code Here

  protected QueryNode preProcessNode(QueryNode node) throws QueryNodeException {

    if (node instanceof FieldableNode) {
      FieldableNode fieldNode = (FieldableNode) node;

      QueryConfigHandler queryConfig = getQueryConfigHandler();

      if (queryConfig == null) {
        throw new IllegalArgumentException(
            "A config handler is expected by the processor UniqueFieldQueryNodeProcessor!");
      }

      if (!queryConfig.has(SpansQueryConfigHandler.UNIQUE_FIELD)) {
        throw new IllegalArgumentException(
            "UniqueFieldAttribute should be defined in the config handler!");
      }

      String uniqueField = queryConfig.get(SpansQueryConfigHandler.UNIQUE_FIELD);
      fieldNode.setField(uniqueField);

    }

    return node;
View Full Code Here

 
  @Override
  protected QueryNode postProcessNode(QueryNode node) throws QueryNodeException {
   
    if (node instanceof ParametricRangeQueryNode) {
      QueryConfigHandler config = getQueryConfigHandler();
     
      if (config != null) {
        ParametricRangeQueryNode parametricRangeNode = (ParametricRangeQueryNode) node;
        FieldConfig fieldConfig = config.getFieldConfig(StringUtils
            .toString(parametricRangeNode.getField()));
       
        if (fieldConfig != null) {
         
          NumericConfig numericConfig = fieldConfig
View Full Code Here

  @Override
  protected QueryNode preProcessNode(QueryNode node) throws QueryNodeException {

    if (node instanceof FuzzyQueryNode) {
      FuzzyQueryNode fuzzyNode = (FuzzyQueryNode) node;
      QueryConfigHandler config = getQueryConfigHandler();

      FuzzyConfig fuzzyConfig = null;
     
      if (config != null && (fuzzyConfig = config.get(ConfigurationKeys.FUZZY_CONFIG)) != null) {
        fuzzyNode.setPrefixLength(fuzzyConfig.getPrefixLength());

        if (fuzzyNode.getSimilarity() < 0) {
          fuzzyNode.setSimilarity(fuzzyConfig.getMinSimilarity());
        }
View Full Code Here

  protected QueryNode postProcessNode(QueryNode node) throws QueryNodeException {
   
    if (node instanceof FieldQueryNode
        && !(node instanceof ParametricQueryNode)) {
     
      QueryConfigHandler config = getQueryConfigHandler();
     
      if (config != null) {
        FieldQueryNode fieldNode = (FieldQueryNode) node;
        FieldConfig fieldConfig = config.getFieldConfig(fieldNode
            .getFieldAsString());
       
        if (fieldConfig != null) {
          NumericConfig numericConfig = fieldConfig
              .get(ConfigurationKeys.NUMERIC_CONFIG);
View Full Code Here

    if (node instanceof FieldableNode &&
        (node.getParent() == null || !(node.getParent() instanceof FieldableNode))) {
     
      FieldableNode fieldNode = (FieldableNode) node;
      QueryConfigHandler config = getQueryConfigHandler();

      if (config != null) {
        CharSequence field = fieldNode.getField();
        FieldConfig fieldConfig = config.getFieldConfig(StringUtils.toString(field));

        if (fieldConfig != null) {
          Float boost = fieldConfig.get(ConfigurationKeys.BOOST);

          if (boost != null) {
View Full Code Here

TOP

Related Classes of org.apache.lucene.queryParser.core.config.QueryConfigHandler

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.