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


Java SolrQueryRequestBase类代码示例

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


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

示例1: newFrom

import org.apache.solr.request.SolrQueryRequestBase; //导入依赖的package包/类
/**
 * Creates a new {@link SolrQueryRequest} from a given prototype and injects there a set of params. 
 * 
 * @param request the prototype {@link SolrQueryRequest}.
 * @param params the parameters that will be injected.
 * @return a {@link SolrQueryRequest} clone.
 */
public SolrQueryRequest newFrom(final SolrQueryRequest request, final SolrParams params) {
	return new SolrQueryRequestBase(
			request.getCore(), 
			new ModifiableSolrParams(params), 
			new RTimerTree()) {
		@Override
		public Map<Object, Object> getContext() {
			return request.getContext();
		}
		
		@Override
		public SolrIndexSearcher getSearcher() {
			return request.getSearcher();
		}
	};
}
 
开发者ID:spaziocodice,项目名称:invisible-queries-request-handler,代码行数:24,代码来源:InvisibleQueriesRequestHandler.java

示例2: handleSuggestionHitsRequest

import org.apache.solr.request.SolrQueryRequestBase; //导入依赖的package包/类
public long handleSuggestionHitsRequest(ReSearcherRequestContext ctx, String query, Set<String> componentNames) throws Exception {
  ModifiableSolrParams params = new ModifiableSolrParams(ctx.getParams());
  params.set(CommonParams.ROWS, "0");
  for(String componentName : componentNames) {
    params.set(componentName, "false");
  }
  params.set(CommonParams.Q, query);

  SolrQueryRequest req = new SolrQueryRequestBase(ctx.getCore(), params) {};
  SolrQueryResponse rsp = new SolrQueryResponse();
  ResponseBuilder rb = new ResponseBuilder(req, rsp, ctx.getQueryOnlyComponents());
  
  try {
    handleSuggestionRequest(ctx, rb, ctx.getQueryOnlyComponents(), true);
  } finally {
    req.close();
  }
  
  return ReSearcherUtils.extractOriginalQueryHits(rb);
}
 
开发者ID:sematext,项目名称:solr-researcher,代码行数:21,代码来源:ReSearcherHandler.java

示例3: addDoc

import org.apache.solr.request.SolrQueryRequestBase; //导入依赖的package包/类
static void addDoc(String doc, String chain) throws Exception {
  Map<String, String[]> params = new HashMap<>();
  MultiMapSolrParams mmparams = new MultiMapSolrParams(params);
  params.put(UpdateParams.UPDATE_CHAIN, new String[] { chain });
  SolrQueryRequestBase req = new SolrQueryRequestBase(h.getCore(),
      (SolrParams) mmparams) {
  };

  UpdateRequestHandler handler = new UpdateRequestHandler();
  handler.init(null);
  ArrayList<ContentStream> streams = new ArrayList<>(2);
  streams.add(new ContentStreamBase.StringStream(doc));
  req.setContentStreams(streams);
  handler.handleRequestBody(req, new SolrQueryResponse());
  req.close();
}
 
开发者ID:europeana,项目名称:search,代码行数:17,代码来源:SignatureUpdateProcessorFactoryTest.java

示例4: addDoc

import org.apache.solr.request.SolrQueryRequestBase; //导入依赖的package包/类
private void addDoc(String doc) throws Exception {
  Map<String, String[]> params = new HashMap<>();
  MultiMapSolrParams mmparams = new MultiMapSolrParams(params);
  params.put(UpdateParams.UPDATE_CHAIN, new String[] { "uniq-fields" });
  SolrQueryRequestBase req = new SolrQueryRequestBase(h.getCore(),
      (SolrParams) mmparams) {
  };

  UpdateRequestHandler handler = new UpdateRequestHandler();
  handler.init(null);
  ArrayList<ContentStream> streams = new ArrayList<>(2);
  streams.add(new ContentStreamBase.StringStream(doc));
  req.setContentStreams(streams);
  handler.handleRequestBody(req, new SolrQueryResponse());
  req.close();
}
 
开发者ID:europeana,项目名称:search,代码行数:17,代码来源:UniqFieldsUpdateProcessorFactoryTest.java

示例5: addDoc

import org.apache.solr.request.SolrQueryRequestBase; //导入依赖的package包/类
static void addDoc(String doc, String chain) throws Exception {
  Map<String, String[]> params = new HashMap<String, String[]>();
  MultiMapSolrParams mmparams = new MultiMapSolrParams(params);
  params.put(UpdateParams.UPDATE_CHAIN, new String[] { chain });
  SolrQueryRequestBase req = new SolrQueryRequestBase(h.getCore(),
      (SolrParams) mmparams) {
  };

  UpdateRequestHandler handler = new UpdateRequestHandler();
  handler.init(null);
  ArrayList<ContentStream> streams = new ArrayList<ContentStream>(2);
  streams.add(new ContentStreamBase.StringStream(doc));
  req.setContentStreams(streams);
  handler.handleRequestBody(req, new SolrQueryResponse());
  req.close();
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:17,代码来源:SignatureUpdateProcessorFactoryTest.java

示例6: addDoc

import org.apache.solr.request.SolrQueryRequestBase; //导入依赖的package包/类
private void addDoc(String doc) throws Exception {
  Map<String, String[]> params = new HashMap<String, String[]>();
  MultiMapSolrParams mmparams = new MultiMapSolrParams(params);
  params.put(UpdateParams.UPDATE_CHAIN, new String[] { "uniq-fields" });
  SolrQueryRequestBase req = new SolrQueryRequestBase(h.getCore(),
      (SolrParams) mmparams) {
  };

  UpdateRequestHandler handler = new UpdateRequestHandler();
  handler.init(null);
  ArrayList<ContentStream> streams = new ArrayList<ContentStream>(2);
  streams.add(new ContentStreamBase.StringStream(doc));
  req.setContentStreams(streams);
  handler.handleRequestBody(req, new SolrQueryResponse());
  req.close();
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:17,代码来源:UniqFieldsUpdateProcessorFactoryTest.java

示例7: handleSuggestionResponseRequest

import org.apache.solr.request.SolrQueryRequestBase; //导入依赖的package包/类
public SolrQueryResponse handleSuggestionResponseRequest(ReSearcherRequestContext ctx, ModifiableSolrParams params, String componentName, List<SearchComponent> components) throws Exception {
  params.set(componentName, "false");

  SolrQueryRequest req = new SolrQueryRequestBase(ctx.getCore(), params) {};
  SolrQueryResponse rsp = new SolrQueryResponse();
  ResponseBuilder rb = new ResponseBuilder(req, rsp, components);
  
  try {
    handleSuggestionRequest(ctx, rb, components, false);
  } finally {
    req.close();
  }
  
  return rsp;
}
 
开发者ID:sematext,项目名称:solr-researcher,代码行数:16,代码来源:ReSearcherHandler.java

示例8: addDoc

import org.apache.solr.request.SolrQueryRequestBase; //导入依赖的package包/类
private void addDoc(String chain, String doc) throws Exception {
  Map<String, String[]> params = new HashMap<>();
  params.put(UpdateParams.UPDATE_CHAIN, new String[] { chain });
  MultiMapSolrParams mmparams = new MultiMapSolrParams(params);
  SolrQueryRequestBase req = new SolrQueryRequestBase(h.getCore(), (SolrParams) mmparams) {
  };

  UpdateRequestHandler handler = new UpdateRequestHandler();
  handler.init(null);
  ArrayList<ContentStream> streams = new ArrayList<>(2);
  streams.add(new ContentStreamBase.StringStream(doc));
  req.setContentStreams(streams);
  handler.handleRequestBody(req, new SolrQueryResponse());
}
 
开发者ID:europeana,项目名称:search,代码行数:15,代码来源:UIMAUpdateRequestProcessorTest.java

示例9: testCharsetInDocument

import org.apache.solr.request.SolrQueryRequestBase; //导入依赖的package包/类
@Test
public void testCharsetInDocument() throws Exception {
  final byte[] xmlBytes = (
    "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\r\n" +
    "<docs>\r\n" +
    " <doc>\r\n" +
    "  <field name=\"id\">Müller</field>\r\n" +
    " </doc>" +
    "</docs>"
  ).getBytes(StandardCharsets.ISO_8859_1);
  
  // we declare a content stream without charset:
  final ContentStream cs = new ByteStream(xmlBytes, "application/xml");
  
  ModifiableSolrParams params = new ModifiableSolrParams();
  SolrQueryRequest req = new SolrQueryRequestBase(h.getCore(), params) {
    @Override
    public Iterable<ContentStream> getContentStreams() {
      return Collections.singleton(cs);
    }
  };

  DocumentAnalysisRequest request = handler.resolveAnalysisRequest(req);
  assertNotNull(request);
  final List<SolrInputDocument> documents = request.getDocuments();
  assertNotNull(documents);
  assertEquals(1, documents.size());
  SolrInputDocument doc = documents.get(0);
  assertEquals("Müller", doc.getField("id").getValue());
}
 
开发者ID:europeana,项目名称:search,代码行数:31,代码来源:DocumentAnalysisRequestHandlerTest.java

示例10: testCharsetOutsideDocument

import org.apache.solr.request.SolrQueryRequestBase; //导入依赖的package包/类
@Test
public void testCharsetOutsideDocument() throws Exception {
  final byte[] xmlBytes = (
    "<docs>\r\n" +
    " <doc>\r\n" +
    "  <field name=\"id\">Müller</field>\r\n" +
    " </doc>" +
    "</docs>"
  ).getBytes(StandardCharsets.ISO_8859_1);
  
  // we declare a content stream with charset:
  final ContentStream cs = new ByteStream(xmlBytes, "application/xml; charset=ISO-8859-1");
  
  ModifiableSolrParams params = new ModifiableSolrParams();
  SolrQueryRequest req = new SolrQueryRequestBase(h.getCore(), params) {
    @Override
    public Iterable<ContentStream> getContentStreams() {
      return Collections.singleton(cs);
    }
  };

  DocumentAnalysisRequest request = handler.resolveAnalysisRequest(req);
  assertNotNull(request);
  final List<SolrInputDocument> documents = request.getDocuments();
  assertNotNull(documents);
  assertEquals(1, documents.size());
  SolrInputDocument doc = documents.get(0);
  assertEquals("Müller", doc.getField("id").getValue());
}
 
开发者ID:europeana,项目名称:search,代码行数:30,代码来源:DocumentAnalysisRequestHandlerTest.java

示例11: addDoc

import org.apache.solr.request.SolrQueryRequestBase; //导入依赖的package包/类
private void addDoc(String chain, String doc) throws Exception {
  Map<String, String[]> params = new HashMap<String, String[]>();
  params.put(UpdateParams.UPDATE_CHAIN, new String[] { chain });
  MultiMapSolrParams mmparams = new MultiMapSolrParams(params);
  SolrQueryRequestBase req = new SolrQueryRequestBase(h.getCore(), (SolrParams) mmparams) {
  };

  UpdateRequestHandler handler = new UpdateRequestHandler();
  handler.init(null);
  ArrayList<ContentStream> streams = new ArrayList<ContentStream>(2);
  streams.add(new ContentStreamBase.StringStream(doc));
  req.setContentStreams(streams);
  handler.handleRequestBody(req, new SolrQueryResponse());
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:15,代码来源:UIMAUpdateRequestProcessorTest.java

示例12: testCharsetInDocument

import org.apache.solr.request.SolrQueryRequestBase; //导入依赖的package包/类
@Test
public void testCharsetInDocument() throws Exception {
  final byte[] xmlBytes = (
    "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\r\n" +
    "<docs>\r\n" +
    " <doc>\r\n" +
    "  <field name=\"id\">Müller</field>\r\n" +
    " </doc>" +
    "</docs>"
  ).getBytes("ISO-8859-1");
  
  // we declare a content stream without charset:
  final ContentStream cs = new ByteStream(xmlBytes, "application/xml");
  
  ModifiableSolrParams params = new ModifiableSolrParams();
  SolrQueryRequest req = new SolrQueryRequestBase(h.getCore(), params) {
    @Override
    public Iterable<ContentStream> getContentStreams() {
      return Collections.singleton(cs);
    }
  };

  DocumentAnalysisRequest request = handler.resolveAnalysisRequest(req);
  assertNotNull(request);
  final List<SolrInputDocument> documents = request.getDocuments();
  assertNotNull(documents);
  assertEquals(1, documents.size());
  SolrInputDocument doc = documents.get(0);
  assertEquals("Müller", doc.getField("id").getValue());
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:31,代码来源:DocumentAnalysisRequestHandlerTest.java

示例13: testCharsetOutsideDocument

import org.apache.solr.request.SolrQueryRequestBase; //导入依赖的package包/类
@Test
public void testCharsetOutsideDocument() throws Exception {
  final byte[] xmlBytes = (
    "<docs>\r\n" +
    " <doc>\r\n" +
    "  <field name=\"id\">Müller</field>\r\n" +
    " </doc>" +
    "</docs>"
  ).getBytes("ISO-8859-1");
  
  // we declare a content stream with charset:
  final ContentStream cs = new ByteStream(xmlBytes, "application/xml; charset=ISO-8859-1");
  
  ModifiableSolrParams params = new ModifiableSolrParams();
  SolrQueryRequest req = new SolrQueryRequestBase(h.getCore(), params) {
    @Override
    public Iterable<ContentStream> getContentStreams() {
      return Collections.singleton(cs);
    }
  };

  DocumentAnalysisRequest request = handler.resolveAnalysisRequest(req);
  assertNotNull(request);
  final List<SolrInputDocument> documents = request.getDocuments();
  assertNotNull(documents);
  assertEquals(1, documents.size());
  SolrInputDocument doc = documents.get(0);
  assertEquals("Müller", doc.getField("id").getValue());
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:30,代码来源:DocumentAnalysisRequestHandlerTest.java

示例14: addDoc

import org.apache.solr.request.SolrQueryRequestBase; //导入依赖的package包/类
static void addDoc(String doc, String chain) throws Exception {
	Map<String, String[]> params = new HashMap<>();
	MultiMapSolrParams mmparams = new MultiMapSolrParams(params);
	params.put(UpdateParams.UPDATE_CHAIN, new String[] { chain });
	SolrQueryRequestBase req = new SolrQueryRequestBase(h.getCore(), mmparams) {
	};

	UpdateRequestHandler handler = new UpdateRequestHandler();
	handler.init(null);
	ArrayList<ContentStream> streams = new ArrayList<>(2);
	streams.add(new ContentStreamBase.StringStream(doc));
	req.setContentStreams(streams);
	handler.handleRequestBody(req, new SolrQueryResponse());
	req.close();
}
 
开发者ID:flaxsearch,项目名称:BioSolr,代码行数:16,代码来源:OntologyUpdateProcessorFactoryTest.java

示例15: query

import org.apache.solr.request.SolrQueryRequestBase; //导入依赖的package包/类
public static SolrQueryResponse query(SolrCore core, String handlerName, SolrParams params) {
  SolrQueryResponse rsp = new SolrQueryResponse();
  SolrQueryRequest req = new SolrQueryRequestBase(core, params) { };
  try {
    SolrRequestHandler handler = core.getRequestHandler(handlerName);
    core.execute(handler, req, rsp);
    return rsp;
  } finally {
    req.close();
  }
}
 
开发者ID:flaxsearch,项目名称:BioSolr,代码行数:12,代码来源:BaseTestCase.java


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