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


Java LocalSolrQueryRequest.setParams方法代码示例

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


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

示例1: request

import org.apache.solr.request.LocalSolrQueryRequest; //导入方法依赖的package包/类
public SolrQueryRequest request(String... q) {
  LocalSolrQueryRequest req = lrf.makeRequest(q);
  ModifiableSolrParams params = new ModifiableSolrParams();
  params.add(req.getParams());
  params.set("distrib", true);
  req.setParams(params);
  return req;
}
 
开发者ID:europeana,项目名称:search,代码行数:9,代码来源:TestZKPropertiesWriter.java

示例2: request

import org.apache.solr.request.LocalSolrQueryRequest; //导入方法依赖的package包/类
public SolrQueryRequest request(String... q) {
  LocalSolrQueryRequest req = lrf.makeRequest(q);
  ModifiableSolrParams params = new ModifiableSolrParams();
  params.add(req.getParams());
  params.set("distrib", false);
  req.setParams(params);
  return req;
}
 
开发者ID:europeana,项目名称:search,代码行数:9,代码来源:BasicZkTest.java

示例3: testSolrParams

import org.apache.solr.request.LocalSolrQueryRequest; //导入方法依赖的package包/类
@Test
public void testSolrParams() throws Exception {
  NamedList nl = new NamedList();
  nl.add("i",555);
  nl.add("s","bbb");
  nl.add("bt","true");
  nl.add("bf","false");

  Map<String,String> m = new HashMap<>();
  m.put("f.field1.i", "1000");
  m.put("s", "BBB");
  m.put("ss", "SSS");

  LocalSolrQueryRequest req = new LocalSolrQueryRequest(null,nl);
  SolrParams p = req.getParams();

  assertEquals(p.get("i"), "555");
  assertEquals(p.getInt("i").intValue(), 555);
  assertEquals(p.getInt("i",5), 555);
  assertEquals(p.getInt("iii",5), 5);
  assertEquals(p.getFieldParam("field1","i"), "555");

  req.setParams(SolrParams.wrapDefaults(p, new MapSolrParams(m)));
  p = req.getParams();
  assertEquals(req.getOriginalParams().get("s"), "bbb");
  assertEquals(p.get("i"), "555");
  assertEquals(p.getInt("i").intValue(), 555);
  assertEquals(p.getInt("i",5), 555);
  assertEquals(p.getInt("iii",5), 5);

  assertEquals(p.getFieldParam("field1","i"), "1000");
  assertEquals(p.get("s"), "bbb");
  assertEquals(p.get("ss"), "SSS");

  assertEquals(!!p.getBool("bt"), !p.getBool("bf"));
  assertEquals(p.getBool("foo",true), true);
  assertEquals(p.getBool("foo",false), false);
  assertEquals(!!p.getBool("bt"), !p.getBool("bf"));

  NamedList more = new NamedList();
  more.add("s", "aaa");
  more.add("s", "ccc");
  more.add("ss","YYY");
  more.add("xx","XXX");
  p = SolrParams.wrapAppended(p, SolrParams.toSolrParams(more));
  assertEquals(3, p.getParams("s").length);
  assertEquals("bbb", p.getParams("s")[0]);
  assertEquals("aaa", p.getParams("s")[1]);
  assertEquals("ccc", p.getParams("s")[2]);
  assertEquals(3, p.getParams("s").length);
  assertEquals("SSS", p.get("ss"));
  assertEquals("XXX", p.get("xx"));

  req.close();
}
 
开发者ID:europeana,项目名称:search,代码行数:56,代码来源:BasicFunctionalityTest.java

示例4: testSolrParams

import org.apache.solr.request.LocalSolrQueryRequest; //导入方法依赖的package包/类
@Test
public void testSolrParams() throws Exception {
  NamedList nl = new NamedList();
  nl.add("i",555);
  nl.add("s","bbb");
  nl.add("bt","true");
  nl.add("bf","false");

  Map<String,String> m = new HashMap<String,String>();
  m.put("f.field1.i", "1000");
  m.put("s", "BBB");
  m.put("ss", "SSS");

  LocalSolrQueryRequest req = new LocalSolrQueryRequest(null,nl);
  SolrParams p = req.getParams();

  assertEquals(p.get("i"), "555");
  assertEquals(p.getInt("i").intValue(), 555);
  assertEquals(p.getInt("i",5), 555);
  assertEquals(p.getInt("iii",5), 5);
  assertEquals(p.getFieldParam("field1","i"), "555");

  req.setParams(SolrParams.wrapDefaults(p, new MapSolrParams(m)));
  p = req.getParams();
  assertEquals(req.getOriginalParams().get("s"), "bbb");
  assertEquals(p.get("i"), "555");
  assertEquals(p.getInt("i").intValue(), 555);
  assertEquals(p.getInt("i",5), 555);
  assertEquals(p.getInt("iii",5), 5);

  assertEquals(p.getFieldParam("field1","i"), "1000");
  assertEquals(p.get("s"), "bbb");
  assertEquals(p.get("ss"), "SSS");

  assertEquals(!!p.getBool("bt"), !p.getBool("bf"));
  assertEquals(p.getBool("foo",true), true);
  assertEquals(p.getBool("foo",false), false);
  assertEquals(!!p.getBool("bt"), !p.getBool("bf"));

  NamedList more = new NamedList();
  more.add("s", "aaa");
  more.add("s", "ccc");
  more.add("ss","YYY");
  more.add("xx","XXX");
  p = SolrParams.wrapAppended(p, SolrParams.toSolrParams(more));
  assertEquals(3, p.getParams("s").length);
  assertEquals("bbb", p.getParams("s")[0]);
  assertEquals("aaa", p.getParams("s")[1]);
  assertEquals("ccc", p.getParams("s")[2]);
  assertEquals(3, p.getParams("s").length);
  assertEquals("SSS", p.get("ss"));
  assertEquals("XXX", p.get("xx"));

  req.close();
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:56,代码来源:BasicFunctionalityTest.java


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