• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java FieldConfig类的典型用法和代码示例

java 1次浏览

本文整理汇总了Java中org.apache.lucene.queryparser.flexible.core.config.FieldConfig的典型用法代码示例。如果您正苦于以下问题:Java FieldConfig类的具体用法?Java FieldConfig怎么用?Java FieldConfig使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

FieldConfig类属于org.apache.lucene.queryparser.flexible.core.config包,在下文中一共展示了FieldConfig类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: buildFieldConfig

点赞 3

import org.apache.lucene.queryparser.flexible.core.config.FieldConfig; //导入依赖的package包/类
@Override
public void buildFieldConfig(FieldConfig fieldConfig) {
  Map<String,NumericConfig> numericConfigMap = config
      .get(ConfigurationKeys.NUMERIC_CONFIG_MAP);
  
  if (numericConfigMap != null) {
    NumericConfig numericConfig = numericConfigMap
        .get(fieldConfig.getField());
    
    if (numericConfig != null) {
      fieldConfig.set(ConfigurationKeys.NUMERIC_CONFIG, numericConfig);
    }
    
  }
  
}
 

开发者ID:lamsfoundation,
项目名称:lams,
代码行数:17,
代码来源:NumericFieldConfigListener.java

示例2: buildFieldConfig

点赞 3

import org.apache.lucene.queryparser.flexible.core.config.FieldConfig; //导入依赖的package包/类
@Override
public void buildFieldConfig(FieldConfig fieldConfig) {
  DateTools.Resolution dateRes = null;
  Map<CharSequence, DateTools.Resolution> dateResMap = this.config.get(ConfigurationKeys.FIELD_DATE_RESOLUTION_MAP);

  if (dateResMap != null) {
    dateRes = dateResMap.get(
        fieldConfig.getField());
  }

  if (dateRes == null) {
    dateRes = this.config.get(ConfigurationKeys.DATE_RESOLUTION);
  }

  if (dateRes != null) {
    fieldConfig.set(ConfigurationKeys.DATE_RESOLUTION, dateRes);
  }

}
 

开发者ID:lamsfoundation,
项目名称:lams,
代码行数:20,
代码来源:FieldDateResolutionFCListener.java

示例3: buildFieldConfig

点赞 2

import org.apache.lucene.queryparser.flexible.core.config.FieldConfig; //导入依赖的package包/类
@Override
public void buildFieldConfig(FieldConfig fieldConfig) {
  Map<String, Float> fieldBoostMap = this.config.get(ConfigurationKeys.FIELD_BOOST_MAP);
  
  if (fieldBoostMap != null) {
    Float boost = fieldBoostMap.get(fieldConfig.getField());

    if (boost != null) {
      fieldConfig.set(ConfigurationKeys.BOOST, boost);
    }

  }
}
 

开发者ID:lamsfoundation,
项目名称:lams,
代码行数:14,
代码来源:FieldBoostMapFCListener.java

示例4: postProcessNode

点赞 2

import org.apache.lucene.queryparser.flexible.core.config.FieldConfig; //导入依赖的package包/类
@Override
protected QueryNode postProcessNode(QueryNode node) throws QueryNodeException {
  
  if (node instanceof FieldQueryNode
      && !(node.getParent() instanceof RangeQueryNode)) {
    
    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);
        
        if (numericConfig != null) {
          
          NumberFormat numberFormat = numericConfig.getNumberFormat();
          String text = fieldNode.getTextAsString();
          Number number = null;
          
          if (text.length() > 0) {
            
            try {
              number = numberFormat.parse(text);
              
            } catch (ParseException e) {
              throw new QueryNodeParseException(new MessageImpl(
                  QueryParserMessages.COULD_NOT_PARSE_NUMBER, fieldNode
                      .getTextAsString(), numberFormat.getClass()
                      .getCanonicalName()), e);
            }
            
            switch (numericConfig.getType()) {
              case LONG:
                number = number.longValue();
                break;
              case INT:
                number = number.intValue();
                break;
              case DOUBLE:
                number = number.doubleValue();
                break;
              case FLOAT:
                number = number.floatValue();
            }
            
          } else {
            throw new QueryNodeParseException(new MessageImpl(
                QueryParserMessages.NUMERIC_CANNOT_BE_EMPTY, fieldNode.getFieldAsString()));
          }
          
          NumericQueryNode lowerNode = new NumericQueryNode(fieldNode
              .getField(), number, numberFormat);
          NumericQueryNode upperNode = new NumericQueryNode(fieldNode
              .getField(), number, numberFormat);
          
          return new NumericRangeQueryNode(lowerNode, upperNode, true, true,
              numericConfig);
          
        }
        
      }
      
    }
    
  }
  
  return node;
  
}
 

开发者ID:lamsfoundation,
项目名称:lams,
代码行数:74,
代码来源:NumericQueryNodeProcessor.java

示例5: postProcessNode

点赞 1

import org.apache.lucene.queryparser.flexible.core.config.FieldConfig; //导入依赖的package包/类
@Override
protected QueryNode postProcessNode(QueryNode node) throws QueryNodeException {

  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) {
          return new BoostQueryNode(node, boost);
        }

      }

    }

  }

  return node;

}
 

开发者ID:lamsfoundation,
项目名称:lams,
代码行数:30,
代码来源:BoostQueryNodeProcessor.java

示例6: getFieldConfig

点赞 1

import org.apache.lucene.queryparser.flexible.core.config.FieldConfig; //导入依赖的package包/类
@Override
public FieldConfig getFieldConfig(String fieldName) {

  // there is no field configuration, always return null
  return null;

}
 

开发者ID:europeana,
项目名称:search,
代码行数:8,
代码来源:SpansQueryConfigHandler.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)