• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java SolrRequestParsers类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: EmbeddedSolrServer

import org.apache.solr.servlet.SolrRequestParsers; //导入依赖的package包/类
/**
 * Use the other constructor using a CoreContainer and a name.
 * @deprecated use {@link #EmbeddedSolrServer(CoreContainer, String)} instead.
 */
@Deprecated
public EmbeddedSolrServer( SolrCore core )
{
  if ( core == null ) {
    throw new NullPointerException("SolrCore instance required");
  }
  CoreDescriptor dcore = core.getCoreDescriptor();
  if (dcore == null)
    throw new NullPointerException("CoreDescriptor required");
  
  CoreContainer cores = dcore.getCoreContainer();
  if (cores == null)
    throw new NullPointerException("CoreContainer required");
  
  coreName = dcore.getName();
  coreContainer = cores;
  _parser = new SolrRequestParsers( null );
}
 
开发者ID:europeana,项目名称:search,代码行数:23,代码来源:EmbeddedSolrServer.java


示例2: setUpBeforeClass

import org.apache.solr.servlet.SolrRequestParsers; //导入依赖的package包/类
@BeforeClass
public static void setUpBeforeClass() throws Exception {
  System.setProperty("enable.update.log", "false"); // schema12 doesn't support _version_
  initCore("solrconfig.xml", "schema12.xml");
  SolrCore core = h.getCore();
  _parser = new SolrRequestParsers( null );
  SolrQueryResponse resp = null;
  parameters = new ModifiableSolrParams();
  parameters.set(RegexpBoostProcessor.BOOST_FILENAME_PARAM, "regex-boost-processor-test.txt");
  parameters.set(RegexpBoostProcessor.INPUT_FIELD_PARAM, "url");
  parameters.set(RegexpBoostProcessor.BOOST_FIELD_PARAM, "urlboost");
  SolrQueryRequest req = _parser.buildRequestFrom(core, new ModifiableSolrParams(), null);
  factory = new RegexpBoostProcessorFactory();
  factory.init(parameters.toNamedList());
  reProcessor = (RegexpBoostProcessor) factory.getInstance(req, resp, null);
}
 
开发者ID:europeana,项目名称:search,代码行数:17,代码来源:RegexBoostProcessorTest.java


示例3: getQueryParams

import org.apache.solr.servlet.SolrRequestParsers; //导入依赖的package包/类
@Override
public SolrParams getQueryParams()
{
  SolrParams solrParams;
  if (solrQuery != null) {
    solrParams = SolrRequestParsers.parseQueryString(solrQuery);
  } else {
    logger.debug("Solr document fetch query is not set, using wild card query for search.");
    solrParams = SolrRequestParsers.parseQueryString("*");
  }
  return solrParams;
}
 
开发者ID:apache,项目名称:apex-malhar,代码行数:13,代码来源:SolrInputOperator.java


示例4: beforeClass

import org.apache.solr.servlet.SolrRequestParsers; //导入依赖的package包/类
@BeforeClass
public static void beforeClass() throws Exception {
  initCore("solrconfig-languageidentifier.xml", "schema.xml", getFile("langid/solr").getAbsolutePath());
  SolrCore core = h.getCore();
  UpdateRequestProcessorChain chained = core.getUpdateProcessingChain("lang_id");
  assertNotNull(chained);
  _parser = new SolrRequestParsers(null);
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:9,代码来源:LanguageIdentifierUpdateProcessorFactoryTestCase.java


示例5: setUpBeforeClass

import org.apache.solr.servlet.SolrRequestParsers; //导入依赖的package包/类
@BeforeClass
public static void setUpBeforeClass() throws Exception {
  initCore("solrconfig.xml", "schema12.xml");
  SolrCore core = h.getCore();
  _parser = new SolrRequestParsers( null );
  SolrQueryResponse resp = null;
  parameters = new ModifiableSolrParams();
  parameters.set(RegexpBoostProcessor.BOOST_FILENAME_PARAM, "regex-boost-processor-test.txt");
  parameters.set(RegexpBoostProcessor.INPUT_FIELD_PARAM, "url");
  parameters.set(RegexpBoostProcessor.BOOST_FIELD_PARAM, "urlboost");
  SolrQueryRequest req = _parser.buildRequestFrom(core, new ModifiableSolrParams(), null);
  factory = new RegexpBoostProcessorFactory();
  factory.init(parameters.toNamedList());
  reProcessor = (RegexpBoostProcessor) factory.getInstance(req, resp, null);
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:16,代码来源:RegexBoostProcessorTest.java


示例6: doFirstQuery

import org.apache.solr.servlet.SolrRequestParsers; //导入依赖的package包/类
/**
 * Do the query using a StringBuffer
 */
public static QueryResponse doFirstQuery(SolrServer server)
		throws SolrServerException {
	StringBuffer request = new StringBuffer();
	request.append("collectionName=" + myCollection);
	request.append("&facet=" + facet);
	request.append("&q=" + query);
	request.append("&start=" + start);
	request.append("&rows=" + nbDocuments);
	SolrParams solrParams = SolrRequestParsers.parseQueryString(request
			.toString());

	return server.query(solrParams);
}
 
开发者ID:BassJel,项目名称:Jouve-Project,代码行数:17,代码来源:SolrJExampleMain.java


示例7: setParam

import org.apache.solr.servlet.SolrRequestParsers; //导入依赖的package包/类
/**
 * Insures that the given param is included in the query with the given value.
 *
 * <ol>
 *   <li>If the param is already included with the given value, the request is returned unchanged.</li>
 *   <li>If the param is not already included, it is added with the given value.</li>
 *   <li>If the param is already included, but with a different value, the value is replaced with the given value.</li>
 *   <li>If the param is already included multiple times, they are replaced with a single param with given value.</li>
 * </ol>
 *
 * The passed-in valueToSet should NOT be URL encoded, as it will be URL encoded by this method.
 *
 * @param query The query portion of a request URL, e.g. "wt=json&indent=on&fl=id,_version_"
 * @param paramToSet The parameter name to insure the presence of in the returned request 
 * @param valueToSet The parameter value to insure in the returned request
 * @return The query with the given param set to the given value 
 */
private static String setParam(String query, String paramToSet, String valueToSet) {
  if (null == valueToSet) {
    valueToSet = "";
  }
  try {
    StringBuilder builder = new StringBuilder();
    if (null == query || query.trim().isEmpty()) {
      // empty query -> return "paramToSet=valueToSet"
      builder.append(paramToSet);
      builder.append('=');
      StrUtils.partialURLEncodeVal(builder, valueToSet);
      return builder.toString();
    }
    MultiMapSolrParams requestParams = SolrRequestParsers.parseQueryString(query);
    String[] values = requestParams.getParams(paramToSet);
    if (null == values) {
      // paramToSet isn't present in the request -> append "&paramToSet=valueToSet"
      builder.append(query);
      builder.append('&');
      builder.append(paramToSet);
      builder.append('=');
      StrUtils.partialURLEncodeVal(builder, valueToSet);
      return builder.toString();
    }
    if (1 == values.length && valueToSet.equals(values[0])) {
      // paramToSet=valueToSet is already in the query - just return the query as-is.
      return query;
    }
    // More than one value for paramToSet on the request, or paramToSet's value is not valueToSet
    // -> rebuild the query
    boolean isFirst = true;
    for (Map.Entry<String,String[]> entry : requestParams.getMap().entrySet()) {
      String key = entry.getKey();
      String[] valarr = entry.getValue();

      if ( ! key.equals(paramToSet)) {
        for (String val : valarr) {
          builder.append(isFirst ? "" : '&');
          isFirst = false;
          builder.append(key);
          builder.append('=');
          StrUtils.partialURLEncodeVal(builder, null == val ? "" : val);
        }
      }
    }
    builder.append(isFirst ? "" : '&');
    builder.append(paramToSet);
    builder.append('=');
    StrUtils.partialURLEncodeVal(builder, valueToSet);
    return builder.toString();
  } catch (IOException e) {
    throw new RuntimeException(e);
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:72,代码来源:RestTestBase.java


示例8: getRequestParsers

import org.apache.solr.servlet.SolrRequestParsers; //导入依赖的package包/类
public SolrRequestParsers getRequestParsers() {
  return solrRequestParsers;
}
 
开发者ID:europeana,项目名称:search,代码行数:4,代码来源:SolrConfig.java


示例9: init

import org.apache.solr.servlet.SolrRequestParsers; //导入依赖的package包/类
@Override
public void init(FilterConfig filterConfig) throws ServletException {
  SolrRequestParsers.DEFAULT.setAddRequestHeadersToContext(true);
}
 
开发者ID:apache,项目名称:incubator-sentry,代码行数:5,代码来源:ModifiableUserAuthenticationFilter.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java EncodingAlgorithm类代码示例发布时间:2022-05-23
下一篇:
Java Loader类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap