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


Java SolrParams.toSolrParams方法代码示例

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


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

示例1: init

import org.apache.solr.common.params.SolrParams; //导入方法依赖的package包/类
/**
 * The UpdateRequestProcessor may be initialized in solrconfig.xml similarly
 * to a RequestHandler, with defaults, appends and invariants.
 * @param args a NamedList with the configuration parameters 
 */
@Override
@SuppressWarnings("rawtypes")
public void init( NamedList args )
{
  if (args != null) {
    Object o;
    o = args.get("defaults");
    if (o != null && o instanceof NamedList) {
      defaults = SolrParams.toSolrParams((NamedList) o);
    } else {
      defaults = SolrParams.toSolrParams(args);
    }
    o = args.get("appends");
    if (o != null && o instanceof NamedList) {
      appends = SolrParams.toSolrParams((NamedList) o);
    }
    o = args.get("invariants");
    if (o != null && o instanceof NamedList) {
      invariants = SolrParams.toSolrParams((NamedList) o);
    }
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:28,代码来源:TikaLanguageIdentifierUpdateProcessorFactory.java

示例2: readSimilarity

import org.apache.solr.common.params.SolrParams; //导入方法依赖的package包/类
static SimilarityFactory readSimilarity(SolrResourceLoader loader, Node node) {
  if (node==null) {
    return null;
  } else {
    SimilarityFactory similarityFactory;
    final String classArg = ((Element) node).getAttribute(SimilarityFactory.CLASS_NAME);
    final Object obj = loader.newInstance(classArg, Object.class, "search.similarities.");
    if (obj instanceof SimilarityFactory) {
      // configure a factory, get a similarity back
      final NamedList<Object> namedList = DOMUtil.childNodesToNamedList(node);
      namedList.add(SimilarityFactory.CLASS_NAME, classArg);
      SolrParams params = SolrParams.toSolrParams(namedList);
      similarityFactory = (SimilarityFactory)obj;
      similarityFactory.init(params);
    } else {
      // just like always, assume it's a Similarity and get a ClassCastException - reasonable error handling
      similarityFactory = new SimilarityFactory() {
        @Override
        public Similarity getSimilarity() {
          return (Similarity) obj;
        }
      };
    }
    return similarityFactory;
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:27,代码来源:IndexSchema.java

示例3: init

import org.apache.solr.common.params.SolrParams; //导入方法依赖的package包/类
@Override
public void init(NamedList args) {
  params = SolrParams.toSolrParams(args);
  this.hdfsDataDir = params.get(HDFS_HOME);
  if (this.hdfsDataDir != null && this.hdfsDataDir.length() == 0) {
    this.hdfsDataDir = null;
  } else {
    LOG.info(HDFS_HOME + "=" + this.hdfsDataDir);
  }
  boolean kerberosEnabled = params.getBool(KERBEROS_ENABLED, false);
  LOG.info("Solr Kerberos Authentication "
      + (kerberosEnabled ? "enabled" : "disabled"));
  if (kerberosEnabled) {
    initKerberos();
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:17,代码来源:HdfsDirectoryFactory.java

示例4: createRequestWithTFilter

import org.apache.solr.common.params.SolrParams; //导入方法依赖的package包/类
private SolrQueryRequest createRequestWithTFilter(String query, String traversalFilter) {
  SolrQueryRequest qr = req(query);
  NamedList par = qr.getParams().toNamedList();
  par.add("traversalFilter", traversalFilter);
  par.add("defType", "graph");
  
  par.add("debug", "true");
  par.add("rows", "10");
  par.add("fl", "id,node_id,edge_id");
  par.remove("qt");
  par.add("qt", "/select");
  // par.add("")
  SolrParams newp = SolrParams.toSolrParams(par);
  qr.setParams(newp);
  return qr;
}
 
开发者ID:kwatters,项目名称:solrgraph,代码行数:17,代码来源:GraphQueryOldTest.java

示例5: createRequestWithTFilter

import org.apache.solr.common.params.SolrParams; //导入方法依赖的package包/类
private SolrQueryRequest createRequestWithTFilter(String query, String traversalFilter) {
  SolrQueryRequest qr = req(query);
  NamedList<Object> par = qr.getParams().toNamedList();
  par.add("traversalFilter", traversalFilter);
  par.add("defType", "kmw");
  
  par.add("debug", "true");
  par.add("rows", "10");
  par.add("fl", "id,node_id,edge_id");
  par.remove("qt");
  par.add("qt", "/select");
  // par.add("")
  SolrParams newp = SolrParams.toSolrParams(par);
  qr.setParams(newp);
  return qr;
}
 
开发者ID:kwatters,项目名称:solrgraph,代码行数:17,代码来源:LargeGraphQueryTest.java

示例6: init

import org.apache.solr.common.params.SolrParams; //导入方法依赖的package包/类
@SuppressWarnings("rawtypes")
public void init(NamedList initArgs) {
	
    SolrParams params = SolrParams.toSolrParams(initArgs);
    String modelDirectory = params.get("modelDirectory",
            System.getProperty("model.dir"));//<co id="qqpp.model"/>
    String wordnetDirectory = params.get("wordnetDirectory",
            System.getProperty("wordnet.dir"));//<co id="qqpp.wordnet"/>
    if (modelDirectory != null) {
      File modelsDir = new File(modelDirectory);
      try {
        InputStream chunkerStream = new FileInputStream(
            new File(modelsDir,"en-chunker.bin"));
        ChunkerModel chunkerModel = new ChunkerModel(chunkerStream);
        chunker = new ChunkerME(chunkerModel); //<co id="qqpp.chunker"/>
        InputStream posStream = new FileInputStream(
            new File(modelsDir,"en-pos-maxent.bin"));
        POSModel posModel = new POSModel(posStream);
        tagger =  new POSTaggerME(posModel); //<co id="qqpp.tagger"/>
       // model = new DoccatModel(new FileInputStream( //<co id="qqpp.theModel"/>
     //       new File(modelDirectory,"en-answer.bin"))).getMaxentModel();
        model = new SuffixSensitiveGISModelReader(new File(modelDirectory+"/qa/ans.bin")).getModel();
        //GISModel m = new SuffixSensitiveGISModelReader(new File(modelFileName)).getModel(); 
        probs = new double[model.getNumOutcomes()];
        atcg = new AnswerTypeContextGenerator(
                new File(wordnetDirectory, "dict"));//<co id="qqpp.context"/>
      } catch (IOException e) {
        throw new RuntimeException(e);
      }
    }
  }
 
开发者ID:asmehra95,项目名称:wiseowl,代码行数:32,代码来源:WiseOwlQParserPlugin.java

示例7: createRequest

import org.apache.solr.common.params.SolrParams; //导入方法依赖的package包/类
private SolrQueryRequest createRequest(String query) {
  SolrQueryRequest qr = req(query);
  NamedList<Object> par = qr.getParams().toNamedList();
  par.add("defType", "kmw");
  par.add("debug", "true");
  par.add("rows", "10");
  par.add("fl", "id,node_id,edge_id");
  par.remove("qt");
  par.add("qt", "/select");
  // par.add("")
  SolrParams newp = SolrParams.toSolrParams(par);
  qr.setParams(newp);
  return qr;
}
 
开发者ID:kwatters,项目名称:solrgraph,代码行数:15,代码来源:GraphQueryOldTest.java

示例8: init

import org.apache.solr.common.params.SolrParams; //导入方法依赖的package包/类
/**
 * The UpdateRequestProcessor may be initialized in solrconfig.xml similarly
 * to a RequestHandler, with defaults, appends and invariants.
 * @param args a NamedList with the configuration parameters 
 */
@Override
@SuppressWarnings("rawtypes")
public void init( NamedList args )
{
  try {
    loadData();
  } catch (Exception e) {
    throw new RuntimeException("Couldn't load profile data, will return empty languages always!", e);
  }
  if (args != null) {
    Object o;
    o = args.get("defaults");
    if (o != null && o instanceof NamedList) {
      defaults = SolrParams.toSolrParams((NamedList) o);
    } else {
      defaults = SolrParams.toSolrParams(args);
    }
    o = args.get("appends");
    if (o != null && o instanceof NamedList) {
      appends = SolrParams.toSolrParams((NamedList) o);
    }
    o = args.get("invariants");
    if (o != null && o instanceof NamedList) {
      invariants = SolrParams.toSolrParams((NamedList) o);
    }
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:33,代码来源:LangDetectLanguageIdentifierUpdateProcessorFactory.java

示例9: init

import org.apache.solr.common.params.SolrParams; //导入方法依赖的package包/类
@Override
public void init( final NamedList args ) {
  if( args != null ) {
    SolrParams params = SolrParams.toSolrParams( args );
    maxNumToLog = params.getInt( "maxNumToLog", maxNumToLog );
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:8,代码来源:LogUpdateProcessorFactory.java

示例10: createRequest

import org.apache.solr.common.params.SolrParams; //导入方法依赖的package包/类
private SolrQueryRequest createRequest(String query) {
   SolrQueryRequest qr = req(query);
   NamedList<Object> par = qr.getParams().toNamedList();
   par.add("defType", "graph");
   par.add("debug", "true");
   par.add("rows", "10");
   par.add("fl", "id,node_id,edge_id");
   par.remove("qt");
   par.add("qt", "/select");
   // par.add("")
   SolrParams newp = SolrParams.toSolrParams(par);
   qr.setParams(newp);
   return qr;
}
 
开发者ID:kwatters,项目名称:solrgraph,代码行数:15,代码来源:JoinQueryTest.java

示例11: createDefaultLoaders

import org.apache.solr.common.params.SolrParams; //导入方法依赖的package包/类
protected Map<String,ContentStreamLoader> createDefaultLoaders(NamedList args) {
  SolrParams p = null;
  if(args!=null) {
    p = SolrParams.toSolrParams(args);
  }
  Map<String,ContentStreamLoader> registry = new HashMap<>();
  registry.put("application/xml", new XMLLoader().init(p) );
  registry.put("application/json", new JsonLoader().init(p) );
  registry.put("application/csv", new CSVLoader().init(p) );
  registry.put("application/javabin", new JavabinLoader().init(p) );
  registry.put("text/csv", registry.get("application/csv") );
  registry.put("text/xml", registry.get("application/xml") );
  registry.put("text/json", registry.get("application/json") );
  return registry;
}
 
开发者ID:europeana,项目名称:search,代码行数:16,代码来源:UpdateRequestHandler.java

示例12: init

import org.apache.solr.common.params.SolrParams; //导入方法依赖的package包/类
public void init(NamedList args) {
  if( args != null ) {
    Object o = args.get("defaults");
    if (o != null && o instanceof NamedList ) {
      defaults = SolrParams.toSolrParams((NamedList)o);
    }
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:9,代码来源:HighlightingPluginBase.java

示例13: init

import org.apache.solr.common.params.SolrParams; //导入方法依赖的package包/类
@Override
public void init(NamedList args) {
  super.init(args);
  SolrParams params = SolrParams.toSolrParams(args);
  maxMergeSizeMB = params.getDouble("maxMergeSizeMB", DEFAULT_MAX_MERGE_SIZE_MB);
  if (maxMergeSizeMB <= 0){
    throw new IllegalArgumentException("maxMergeSizeMB must be greater than 0");
  }
  maxCachedMB = params.getDouble("maxCachedMB", DEFAULT_MAX_CACHED_MB);
  if (maxCachedMB <= 0){
    throw new IllegalArgumentException("maxCachedMB must be greater than 0");
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:14,代码来源:NRTCachingDirectoryFactory.java

示例14: createRequest

import org.apache.solr.common.params.SolrParams; //导入方法依赖的package包/类
private SolrQueryRequest createRequest(String query) {
	SolrQueryRequest qr = req(query);
	// TODO: really, parameterized as Object?
	NamedList<Object> par = qr.getParams().toNamedList();
	par.add("defType", "kmw");
	par.add("debug", "true");
	par.add("rows", "10");
	par.add("fl", "id");
	par.remove("qt");
	par.add("qt", "/select");
	SolrParams newp = SolrParams.toSolrParams(par);
	qr.setParams(newp);
	return qr;
}
 
开发者ID:kwatters,项目名称:solrgraph,代码行数:15,代码来源:RangeTermQueryTest.java

示例15: init

import org.apache.solr.common.params.SolrParams; //导入方法依赖的package包/类
/**
 * Component initialisation.
 */
@SuppressWarnings("rawtypes")
@Override
public void init(final NamedList args) {
	
	// 1.Retrieve the configuration parameters. 
	// First a "dummy" mode flag, which indicates we are running the 
	// example without a database.
	// If the dummy mode is set to true the get the datasource name
	// This component uses a database as external resource, but it could be
	// also a web service. In any case, this is the place where that
	// resource should be initialized.
	final SolrParams params = SolrParams.toSolrParams(args);
	final boolean isInDummyMode = params.getBool("dummy-mode", true);
	if (isInDummyMode) {
		hasBeenCorrectlyInitialised = true;
		return;
	}
	
	final String datasourceName = params.get("datasource-jndi-name", "jdbc/pricesdb");

	// In case you want give a try, this component actually stubs its
	// behaviour.
	// This is because otherwise we should have a database somewhere, we
	// should configure a datasource and so on...
	// The following code is therefore commented and should be used in case
	// you set up a valid datasource
	try {
		// 2. Obtain a reference to the naming context
		final Context ctx = new InitialContext();

		// 3. Lookup the datasource.
		datasource = (DataSource) ctx.lookup(datasourceName);

		// 4. Give a try by opening and immediately opening a connection.
		datasource.getConnection().close();
		
		// 5a. Mark this component as valid
		hasBeenCorrectlyInitialised = false;
	} catch (final Exception exception) {
		exception.printStackTrace();

		// 5b. Mark this component as invalid (no strictly needed)
		hasBeenCorrectlyInitialised = false;
	}
}
 
开发者ID:agazzarini,项目名称:as-full-text-search-server,代码行数:49,代码来源:CustomSearchComponent.java


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