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


Java LocalSolrQueryRequest.setContentStreams方法代码示例

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


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

示例1: loadLocalFromHandler

import org.apache.solr.request.LocalSolrQueryRequest; //导入方法依赖的package包/类
SolrQueryResponse loadLocalFromHandler(String handler, String filename, 
                                       String... args) throws Exception {
                            
  LocalSolrQueryRequest req = (LocalSolrQueryRequest) req(args);
  try {
    // TODO: stop using locally defined streams once stream.file and
    // stream.body work everywhere
    List<ContentStream> cs = new ArrayList<>();
    cs.add(new ContentStreamBase.FileStream(getFile(filename)));
    req.setContentStreams(cs);
    return h.queryAndResponse(handler, req);
  } finally {
    req.close();
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:16,代码来源:ExtractingRequestHandlerTest.java

示例2: loadLocal

import org.apache.solr.request.LocalSolrQueryRequest; //导入方法依赖的package包/类
void loadLocal(String... args) throws Exception {
  LocalSolrQueryRequest req =  (LocalSolrQueryRequest)req(args);

  // TODO: stop using locally defined streams once stream.file and
  // stream.body work everywhere
  List<ContentStream> cs = new ArrayList<>(1);
  ContentStreamBase f = new ContentStreamBase.FileStream(new File(filename));
  f.setContentType("text/csv");
  cs.add(f);
  req.setContentStreams(cs);
  h.query("/update",req);
}
 
开发者ID:europeana,项目名称:search,代码行数:13,代码来源:TestCSVLoader.java

示例3: testUpdate

import org.apache.solr.request.LocalSolrQueryRequest; //导入方法依赖的package包/类
@Test
public void testUpdate() throws Exception
{
  String xml = 
    "<random>" +
    " <document>" +
    "  <node name=\"id\" value=\"12345\"/>" +
    "  <node name=\"name\" value=\"kitten\"/>" +
    "  <node name=\"text\" enhance=\"3\" value=\"some other day\"/>" +
    "  <node name=\"title\" enhance=\"4\" value=\"A story\"/>" +
    "  <node name=\"timestamp\" enhance=\"5\" value=\"2011-07-01T10:31:57.140Z\"/>" +
    " </document>" +
    "</random>";

  Map<String,String> args = new HashMap<>();
  args.put(CommonParams.TR, "xsl-update-handler-test.xsl");
    
  SolrCore core = h.getCore();
  LocalSolrQueryRequest req = new LocalSolrQueryRequest( core, new MapSolrParams( args) );
  ArrayList<ContentStream> streams = new ArrayList<>();
  streams.add(new ContentStreamBase.StringStream(xml));
  req.setContentStreams(streams);
  SolrQueryResponse rsp = new SolrQueryResponse();
  UpdateRequestHandler handler = new UpdateRequestHandler();
  handler.init(new NamedList<String>());
  handler.handleRequestBody(req, rsp);
  StringWriter sw = new StringWriter(32000);
  QueryResponseWriter responseWriter = core.getQueryResponseWriter(req);
  responseWriter.write(sw,req,rsp);
  req.close();
  String response = sw.toString();
  assertU(response);
  assertU(commit());

  assertQ("test document was correctly committed", req("q","*:*")
          , "//result[@numFound='1']"
          , "//int[@name='id'][.='12345']"
      );
}
 
开发者ID:europeana,项目名称:search,代码行数:40,代码来源:XsltUpdateRequestHandlerTest.java

示例4: loadLocal

import org.apache.solr.request.LocalSolrQueryRequest; //导入方法依赖的package包/类
SolrQueryResponse loadLocal(String filename, String... args) throws Exception {
  LocalSolrQueryRequest req = (LocalSolrQueryRequest) req(args);
  try {
    // TODO: stop using locally defined streams once stream.file and
    // stream.body work everywhere
    List<ContentStream> cs = new ArrayList<ContentStream>();
    cs.add(new ContentStreamBase.FileStream(getFile(filename)));
    req.setContentStreams(cs);
    return h.queryAndResponse("/update/extract", req);
  } finally {
    req.close();
  }
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:14,代码来源:ExtractingRequestHandlerTest.java

示例5: loadLocal

import org.apache.solr.request.LocalSolrQueryRequest; //导入方法依赖的package包/类
void loadLocal(String... args) throws Exception {
  LocalSolrQueryRequest req =  (LocalSolrQueryRequest)req(args);

  // TODO: stop using locally defined streams once stream.file and
  // stream.body work everywhere
  List<ContentStream> cs = new ArrayList<ContentStream>(1);
  ContentStreamBase f = new ContentStreamBase.FileStream(new File(filename));
  f.setContentType("text/csv");
  cs.add(f);
  req.setContentStreams(cs);
  h.query("/update",req);
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:13,代码来源:TestCSVLoader.java

示例6: testUpdate

import org.apache.solr.request.LocalSolrQueryRequest; //导入方法依赖的package包/类
@Test
public void testUpdate() throws Exception
{
  String xml = 
    "<random>" +
    " <document>" +
    "  <node name=\"id\" value=\"12345\"/>" +
    "  <node name=\"name\" value=\"kitten\"/>" +
    "  <node name=\"text\" enhance=\"3\" value=\"some other day\"/>" +
    "  <node name=\"title\" enhance=\"4\" value=\"A story\"/>" +
    "  <node name=\"timestamp\" enhance=\"5\" value=\"2011-07-01T10:31:57.140Z\"/>" +
    " </document>" +
    "</random>";

  Map<String,String> args = new HashMap<String, String>();
  args.put(CommonParams.TR, "xsl-update-handler-test.xsl");
    
  SolrCore core = h.getCore();
  LocalSolrQueryRequest req = new LocalSolrQueryRequest( core, new MapSolrParams( args) );
  ArrayList<ContentStream> streams = new ArrayList<ContentStream>();
  streams.add(new ContentStreamBase.StringStream(xml));
  req.setContentStreams(streams);
  SolrQueryResponse rsp = new SolrQueryResponse();
  UpdateRequestHandler handler = new UpdateRequestHandler();
  handler.init(new NamedList<String>());
  handler.handleRequestBody(req, rsp);
  StringWriter sw = new StringWriter(32000);
  QueryResponseWriter responseWriter = core.getQueryResponseWriter(req);
  responseWriter.write(sw,req,rsp);
  req.close();
  String response = sw.toString();
  assertU(response);
  assertU(commit());

  assertQ("test document was correctly committed", req("q","*:*")
          , "//result[@numFound='1']"
          , "//int[@name='id'][.='12345']"
      );
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:40,代码来源:XsltUpdateRequestHandlerTest.java


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