當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。