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


Java SolrParams.getParams方法代码示例

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


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

示例1: SolrContentHandler

import org.apache.solr.common.params.SolrParams; //导入方法依赖的package包/类
public SolrContentHandler(Metadata metadata, SolrParams params,
                          IndexSchema schema, Collection<String> dateFormats) {
  this.document = new SolrInputDocument();
  this.metadata = metadata;
  this.params = params;
  this.schema = schema;
  this.dateFormats = dateFormats;

  this.lowerNames = params.getBool(LOWERNAMES, false);
  this.captureAttribs = params.getBool(CAPTURE_ATTRIBUTES, false);
  this.literalsOverride = params.getBool(LITERALS_OVERRIDE, true);
  this.unknownFieldPrefix = params.get(UNKNOWN_FIELD_PREFIX, "");
  this.defaultField = params.get(DEFAULT_FIELD, "");
  
  String[] captureFields = params.getParams(CAPTURE_ELEMENTS);
  if (captureFields != null && captureFields.length > 0) {
    fieldBuilders = new HashMap<>();
    for (int i = 0; i < captureFields.length; i++) {
      fieldBuilders.put(captureFields[i], new StringBuilder());
    }
  } else {
    fieldBuilders = Collections.emptyMap();
  }
  bldrStack.add(catchAllBuilder);
}
 
开发者ID:europeana,项目名称:search,代码行数:26,代码来源:SolrContentHandler.java

示例2: getCustomFieldsMap

import org.apache.solr.common.params.SolrParams; //导入方法依赖的package包/类
/**
 * Prepares a map of Solr field names (keys) to the corresponding Carrot2
 * custom field names.
 */
private Map<String, String> getCustomFieldsMap(SolrParams solrParams) {
  Map<String, String> customFields = Maps.newHashMap();
  String [] customFieldsSpec = solrParams.getParams(CarrotParams.CUSTOM_FIELD_NAME);
  if (customFieldsSpec != null) {
    customFields = Maps.newHashMap();
    for (String customFieldSpec : customFieldsSpec) {
      String [] split = customFieldSpec.split(":"); 
      if (split.length == 2 && StringUtils.isNotBlank(split[0]) && StringUtils.isNotBlank(split[1])) {
        customFields.put(split[0], split[1]);
      } else {
        log.warn("Unsupported format for " + CarrotParams.CUSTOM_FIELD_NAME
            + ": '" + customFieldSpec + "'. Skipping this field definition.");
      }
    }
  }
  return customFields;
}
 
开发者ID:europeana,项目名称:search,代码行数:22,代码来源:CarrotClusteringEngine.java

示例3: addBoostFunctions

import org.apache.solr.common.params.SolrParams; //导入方法依赖的package包/类
protected void addBoostFunctions(BooleanQuery query, SolrParams solrParams) throws SyntaxError {
  String[] boostFuncs = solrParams.getParams(DisMaxParams.BF);
  if (null != boostFuncs && 0 != boostFuncs.length) {
    for (String boostFunc : boostFuncs) {
      if (null == boostFunc || "".equals(boostFunc)) continue;
      Map<String, Float> ff = SolrPluginUtils.parseFieldBoosts(boostFunc);
      for (String f : ff.keySet()) {
        Query fq = subQuery(f, FunctionQParserPlugin.NAME).getQuery();
        Float b = ff.get(f);
        if (null != b) {
          fq.setBoost(b);
        }
        query.add(fq, BooleanClause.Occur.SHOULD);
      }
    }
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:18,代码来源:DisMaxQParser.java

示例4: getFieldsParameter

import org.apache.solr.common.params.SolrParams; //导入方法依赖的package包/类
protected String[] getFieldsParameter(SolrParams params) {
    final String paramName = getPrefix() + "." + JointProbabilityParams.FIELDS;

    String[] fields = params.getParams(paramName);
    if(fields == null || fields.length == 0){
        fields = this.fields;
    }
    if(fields == null || fields.length == 0){
        throw new SolrException(
                SolrException.ErrorCode.BAD_REQUEST,
                String.format("%s is a required parameter", paramName)
        );
    }

    for(int i = 0; i<fields.length; i++){
        String fld = fields[i];
        // if a single field, make a pair
        if(fld.split(",").length == 0){
            throw new SolrException (SolrException.ErrorCode.BAD_REQUEST,"No fields specified");
        }
    }
    return fields;
}
 
开发者ID:DiceTechJobs,项目名称:SolrPlugins,代码行数:24,代码来源:JointProbabilityComponentBase.java

示例5: parse

import org.apache.solr.common.params.SolrParams; //导入方法依赖的package包/类
void parse(SolrParams params, ResponseBuilder rb) {
  queryFacets = new LinkedHashMap<>();
  facets = new LinkedHashMap<>();

  String[] facetQs = params.getParams(FacetParams.FACET_QUERY);
  if (facetQs != null) {
    for (String query : facetQs) {
      QueryFacet queryFacet = new QueryFacet(rb, query);
      queryFacets.put(queryFacet.getKey(), queryFacet);
    }
  }
  
  String[] facetFs = params.getParams(FacetParams.FACET_FIELD);
  if (facetFs != null) {
    
    for (String field : facetFs) {
      final DistribFieldFacet ff;
      
      if (params.getFieldBool(field, FacetParams.FACET_EXISTS, false)) {
        // cap facet count by 1 with this method
        ff = new DistribFacetExistsField(rb, field);
      } else {
        ff = new DistribFieldFacet(rb, field);
      }
      facets.put(ff.getKey(), ff);
    }
  }

  // Develop Pivot Facet Information
  String[] facetPFs = params.getParams(FacetParams.FACET_PIVOT);
  if (facetPFs != null) {
    for (String fieldGroup : facetPFs) {
      PivotFacet pf = new PivotFacet(rb, fieldGroup);
      pivotFacets.add(pf.getKey(), pf);
    }
  }

  heatmapFacets = SpatialHeatmapFacets.distribParse(params, rb);
}
 
开发者ID:upenn-libraries,项目名称:solrplugins,代码行数:40,代码来源:FacetComponent.java

示例6: toMultiMap

import org.apache.solr.common.params.SolrParams; //导入方法依赖的package包/类
/** Create a Map&lt;String,String[]&gt; from {@link org.apache.solr.common.params.SolrParams}*/
public static Map<String, String[]> toMultiMap(SolrParams solrParams) {
  HashMap<String,String[]> multiValuedMap = new HashMap<String, String[]>();
  Iterator<String> params = solrParams.getParameterNamesIterator();
  while (params.hasNext()) {
    String param = params.next();
    String[] values = solrParams.getParams(param);
    if (values != null) {
      multiValuedMap.put(param, values);
    }
  }
  return multiValuedMap;
}
 
开发者ID:lucidworks,项目名称:fusion-solr-plugins,代码行数:14,代码来源:LogToFusionComponent.java

示例7: toQueryString

import org.apache.solr.common.params.SolrParams; //导入方法依赖的package包/类
public static String toQueryString( SolrParams params, boolean xml ) {
  StringBuilder sb = new StringBuilder(128);
  try {
    String amp = xml ? "&amp;" : "&";
    boolean first=true;
    Iterator<String> names = params.getParameterNamesIterator();
    while( names.hasNext() ) {
      String key = names.next();
      String[] valarr = params.getParams( key );
      if( valarr == null ) {
        sb.append( first?"?":amp );
        sb.append(key);
        first=false;
      }
      else {
        for (String val : valarr) {
          sb.append( first? "?":amp );
          sb.append(key);
          if( val != null ) {
            sb.append('=');
            sb.append( URLEncoder.encode( val, "UTF-8" ) );
          }
          first=false;
        }
      }
    }
  }
  catch (IOException e) {throw new RuntimeException(e);}  // can't happen
  return sb.toString();
}
 
开发者ID:europeana,项目名称:search,代码行数:31,代码来源:ClientUtils.java

示例8: getParamsMap

import org.apache.solr.common.params.SolrParams; //导入方法依赖的package包/类
private Map<String, Object> getParamsMap(SolrParams params) {
  Iterator<String> names = params.getParameterNamesIterator();
  Map<String, Object> result = new HashMap<>();
  while (names.hasNext()) {
    String s = names.next();
    String[] val = params.getParams(s);
    if (val == null || val.length < 1)
      continue;
    if (val.length == 1)
      result.put(s, val[0]);
    else
      result.put(s, Arrays.asList(val));
  }
  return result;
}
 
开发者ID:europeana,项目名称:search,代码行数:16,代码来源:DataImportHandler.java

示例9: passParam

import org.apache.solr.common.params.SolrParams; //导入方法依赖的package包/类
private void passParam(SolrParams params, ModifiableSolrParams fparams, String param) {
  String[] values = params.getParams(param);
  if (values != null) {
    for (String value : values) {
      fparams.add(param, value);
    }
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:9,代码来源:DistributedUpdateProcessor.java

示例10: initHidden

import org.apache.solr.common.params.SolrParams; //导入方法依赖的package包/类
public static Set<String> initHidden(SolrParams invariants) {

    Set<String> hiddenRet = new HashSet<>();
    // Build a list of hidden files
    if (invariants != null) {
      String[] hidden = invariants.getParams(HIDDEN);
      if (hidden != null) {
        for (String s : hidden) {
          hiddenRet.add(s.toUpperCase(Locale.ROOT));
        }
      }
    }
    return hiddenRet;
  }
 
开发者ID:europeana,项目名称:search,代码行数:15,代码来源:ShowFileRequestHandler.java

示例11: parse

import org.apache.solr.common.params.SolrParams; //导入方法依赖的package包/类
void parse(SolrParams params, ResponseBuilder rb) {
  queryFacets = new LinkedHashMap<>();
  facets = new LinkedHashMap<>();

  String[] facetQs = params.getParams(FacetParams.FACET_QUERY);
  if (facetQs != null) {
    for (String query : facetQs) {
      QueryFacet queryFacet = new QueryFacet(rb, query);
      queryFacets.put(queryFacet.getKey(), queryFacet);
    }
  }
  
  String[] facetFs = params.getParams(FacetParams.FACET_FIELD);
  if (facetFs != null) {
    
    for (String field : facetFs) {
      DistribFieldFacet ff = new DistribFieldFacet(rb, field);
      facets.put(ff.getKey(), ff);
    }
  }

  // Develop Pivot Facet Information
  String[] facetPFs = params.getParams(FacetParams.FACET_PIVOT);
  if (facetPFs != null) {
    for (String fieldGroup : facetPFs) {
      PivotFacet pf = new PivotFacet(rb, fieldGroup);
      pivotFacets.add(pf.getKey(), pf);
    }
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:31,代码来源:FacetComponent.java

示例12: handleRequestBody

import org.apache.solr.common.params.SolrParams; //导入方法依赖的package包/类
/**
 * Expands aliases into queries for thematic collections.
 * 
 * Operates by taking apart the passed request, scanning it for thematic-collection keywords,
 * and replacing those it finds with the appropriate expanded query.
 * 
 * @author thill
 * @version 2017.11.14
 */

@Override
public void handleRequestBody(SolrQueryRequest req, SolrQueryResponse rsp)
    throws Exception {
  
  AliasConfig aliasConfig = req.getCore().getAliasConfig();
  HashMap<String, HashMap<String, String>> aliases = aliasConfig.getAliases();
  SolrParams params = req.getParams();
  Iterator<String> pnit = params.getParameterNamesIterator();
  Map<String, String[]> modifiedParams = new HashMap<String, String[]>();
  String paramnames = "";
  while(pnit.hasNext()) {
    
    String pname = pnit.next();
    paramnames += pname + " ";
    String[] pvalues = params.getParams(pname);
    if(!pname.equals("q") && !pname.equals("fq")) {
      
      modifiedParams.put(pname, pvalues);
      
    }
    else {
      String[] modifiedValues = this.modifyValues(aliases, pvalues);
      modifiedParams.put(pname, modifiedValues);
    
    }
    
  }
  MultiMapSolrParams newParams = new MultiMapSolrParams(modifiedParams);
  req.setParams(newParams);
  // a little debugging check
  //String paramCheck = outputParams(newParams);
  // rsp.add("test", paramCheck);
  super.handleRequestBody(req, rsp);
  
}
 
开发者ID:europeana,项目名称:search,代码行数:46,代码来源:AliasingRequestHandler.java

示例13: getDictionaryNames

import org.apache.solr.common.params.SolrParams; //导入方法依赖的package包/类
private String[] getDictionaryNames(SolrParams params) {
  String[] dictName = params.getParams(SPELLCHECK_DICT);
  if (dictName == null) {
    return new String[] {SolrSpellChecker.DEFAULT_DICTIONARY_NAME};
  }
  return dictName;
}
 
开发者ID:europeana,项目名称:search,代码行数:8,代码来源:SpellCheckComponent.java

示例14: parse

import org.apache.solr.common.params.SolrParams; //导入方法依赖的package包/类
void parse(SolrParams params, ResponseBuilder rb) {
  statsFields = new HashMap<>();

  String[] statsFs = params.getParams(StatsParams.STATS_FIELD);
  if (statsFs != null) {
    for (String field : statsFs) {
      boolean calcDistinct = params.getFieldBool(field, StatsParams.STATS_CALC_DISTINCT, false);
      SchemaField sf = rb.req.getSchema().getField(field);
      statsFields.put(field, StatsValuesFactory.createStatsValues(sf, calcDistinct));
    }
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:13,代码来源:StatsComponent.java

示例15: getSuggesterNames

import org.apache.solr.common.params.SolrParams; //导入方法依赖的package包/类
private Set<String> getSuggesterNames(SolrParams params) {
  Set<String> suggesterNames = new HashSet<>();
  String[] suggesterNamesFromParams = params.getParams(SUGGEST_DICT);
  if (suggesterNamesFromParams == null) {
    suggesterNames.add(DEFAULT_DICT_NAME);
  } else {
    for (String name : suggesterNamesFromParams) {
      suggesterNames.add(name);
    }
  }
  return suggesterNames;   
}
 
开发者ID:europeana,项目名称:search,代码行数:13,代码来源:SuggestComponent.java


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