当前位置: 首页>>代码示例>>Java>>正文


Java QParser.getLocalParams方法代码示例

本文整理汇总了Java中org.apache.solr.search.QParser.getLocalParams方法的典型用法代码示例。如果您正苦于以下问题:Java QParser.getLocalParams方法的具体用法?Java QParser.getLocalParams怎么用?Java QParser.getLocalParams使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.solr.search.QParser的用法示例。


在下文中一共展示了QParser.getLocalParams方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getQueryFromSpatialArgs

import org.apache.solr.search.QParser; //导入方法依赖的package包/类
private Query getQueryFromSpatialArgs(QParser parser, SchemaField field, SpatialArgs spatialArgs) {
  T strategy = getStrategy(field.getName());

  SolrParams localParams = parser.getLocalParams();
  String scoreParam = (localParams == null ? null : localParams.get(SCORE_PARAM));

  //We get the valueSource for the score then the filter and combine them.

  ValueSource valueSource = getValueSourceFromSpatialArgs(parser, field, spatialArgs, scoreParam, strategy);
  if (valueSource == null) {
    //FYI Solr FieldType doesn't have a getFilter(). We'll always grab
    // getQuery() but it's possible a strategy has a more efficient getFilter
    // that could be wrapped -- no way to know.
    //See SOLR-2883 needScore
    return strategy.makeQuery(spatialArgs); //ConstantScoreQuery
  }

  FunctionQuery functionQuery = new FunctionQuery(valueSource);

  if (localParams != null && !localParams.getBool(FILTER_PARAM, true))
    return functionQuery;

  Filter filter = strategy.makeFilter(spatialArgs);
  return new FilteredQuery(functionQuery, filter);
}
 
开发者ID:europeana,项目名称:search,代码行数:26,代码来源:AbstractSpatialFieldType.java

示例2: getQueryFromSpatialArgs

import org.apache.solr.search.QParser; //导入方法依赖的package包/类
private Query getQueryFromSpatialArgs(QParser parser, SchemaField field, SpatialArgs spatialArgs) {
  T strategy = getStrategy(field.getName());

  SolrParams localParams = parser.getLocalParams();
  String score = (localParams == null ? null : localParams.get(SCORE_PARAM));
  if (score == null || "none".equals(score) || "".equals(score)) {
    //FYI Solr FieldType doesn't have a getFilter(). We'll always grab
    // getQuery() but it's possible a strategy has a more efficient getFilter
    // that could be wrapped -- no way to know.
    //See SOLR-2883 needScore
    return strategy.makeQuery(spatialArgs); //ConstantScoreQuery
  }

  //We get the valueSource for the score then the filter and combine them.
  ValueSource valueSource;
  if ("distance".equals(score))
    valueSource = strategy.makeDistanceValueSource(spatialArgs.getShape().getCenter());
  else if ("recipDistance".equals(score))
    valueSource = strategy.makeRecipDistanceValueSource(spatialArgs.getShape());
  else
    throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "'score' local-param must be one of 'none', 'distance', or 'recipDistance'");
  FunctionQuery functionQuery = new FunctionQuery(valueSource);

  if (localParams != null && !localParams.getBool(FILTER_PARAM, true))
    return functionQuery;

  Filter filter = strategy.makeFilter(spatialArgs);
  return new FilteredQuery(functionQuery, filter);
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:30,代码来源:AbstractSpatialFieldType.java

示例3: getQueryFromSpatialArgs

import org.apache.solr.search.QParser; //导入方法依赖的package包/类
private Query getQueryFromSpatialArgs(QParser parser, SchemaField field, SpatialArgs spatialArgs) {
  T strategy = getStrategy(field.getName());

  SolrParams localParams = parser.getLocalParams();
  String score = (localParams == null ? null : localParams.get(SCORE_PARAM));
  if (score == null || "none".equals(score) || "".equals(score)) {
    //FYI Solr FieldType doesn't have a getFilter(). We'll always grab
    // getQuery() but it's possible a strategy has a more efficient getFilter
    // that could be wrapped -- no way to know.
    //See SOLR-2883 needScore
    return strategy.makeQuery(spatialArgs); //ConstantScoreQuery
  }

  //We get the valueSource for the score then the filter and combine them.
  ValueSource valueSource;
  if ("distance".equals(score)) {
    double multiplier = 1.0;//TODO support units=kilometers
    valueSource = strategy.makeDistanceValueSource(spatialArgs.getShape().getCenter(), multiplier);
  } else if ("recipDistance".equals(score)) {
    valueSource = strategy.makeRecipDistanceValueSource(spatialArgs.getShape());
  } else {
    throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "'score' local-param must be one of 'none', 'distance', or 'recipDistance'");
  }
  FunctionQuery functionQuery = new FunctionQuery(valueSource);

  if (localParams != null && !localParams.getBool(FILTER_PARAM, true))
    return functionQuery;

  Filter filter = strategy.makeFilter(spatialArgs);
  return new FilteredQuery(functionQuery, filter);
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:32,代码来源:AbstractSpatialFieldType.java


注:本文中的org.apache.solr.search.QParser.getLocalParams方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。