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


Java UpdateRequestProcessor类代码示例

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


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

示例1: ExtractingDocumentLoader

import org.apache.solr.update.processor.UpdateRequestProcessor; //导入依赖的package包/类
public ExtractingDocumentLoader(SolrQueryRequest req, UpdateRequestProcessor processor,
                         TikaConfig config, SolrContentHandlerFactory factory) {
  this.params = req.getParams();
  this.core = req.getCore();
  this.config = config;
  this.processor = processor;

  templateAdd = new AddUpdateCommand(req);
  templateAdd.overwrite = params.getBool(UpdateParams.OVERWRITE, true);
  templateAdd.commitWithin = params.getInt(UpdateParams.COMMIT_WITHIN, -1);

  //this is lightweight
  autoDetectParser = new AutoDetectParser(config);
  this.factory = factory;
  
  ignoreTikaException = params.getBool(ExtractingParams.IGNORE_TIKA_EXCEPTION, false);
}
 
开发者ID:europeana,项目名称:search,代码行数:18,代码来源:ExtractingDocumentLoader.java

示例2: getInstance

import org.apache.solr.update.processor.UpdateRequestProcessor; //导入依赖的package包/类
@Override
public UpdateRequestProcessor getInstance(SolrQueryRequest req,
    SolrQueryResponse rsp, UpdateRequestProcessor next) {
  SolrUIMAConfiguration configuration = new SolrUIMAConfigurationReader(args)
      .readSolrUIMAConfiguration();
  synchronized (this) {
    if (ae == null && pool == null) {
      AEProvider aeProvider = AEProviderFactory.getInstance().getAEProvider(
          req.getCore().getName(), configuration.getAePath(),
          configuration.getRuntimeParameters());
      try {
        ae = aeProvider.getAE();
        pool = new JCasPool(10, ae);
      } catch (ResourceInitializationException e) {
        throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, e);
      }
    }
  }
  
  return new UIMAUpdateRequestProcessor(next, req.getCore().getName(),
      configuration, ae, pool);
}
 
开发者ID:europeana,项目名称:search,代码行数:23,代码来源:UIMAUpdateRequestProcessorFactory.java

示例3: testMultiMap

import org.apache.solr.update.processor.UpdateRequestProcessor; //导入依赖的package包/类
@Test
public void testMultiMap() {
  SolrCore core = h.getCore();
  UpdateRequestProcessorChain chained = core.getUpdateProcessingChain("uima-multi-map");
  assertNotNull(chained);
  UIMAUpdateRequestProcessorFactory factory = (UIMAUpdateRequestProcessorFactory) chained
          .getFactories()[0];
  assertNotNull(factory);
  UpdateRequestProcessor processor = factory.getInstance(req(), null, null);
  assertTrue(processor instanceof UIMAUpdateRequestProcessor);
  SolrUIMAConfiguration conf = ((UIMAUpdateRequestProcessor)processor).solrUIMAConfiguration;
  Map<String, Map<String, MapField>> map = conf.getTypesFeaturesFieldsMapping();
  Map<String, MapField> subMap = map.get("a-type-which-can-have-multiple-features");
  assertEquals(2, subMap.size());
  assertEquals("1", subMap.get("A").getFieldName(null));
  assertEquals("2", subMap.get("B").getFieldName(null));
}
 
开发者ID:europeana,项目名称:search,代码行数:18,代码来源:UIMAUpdateRequestProcessorTest.java

示例4: load

import org.apache.solr.update.processor.UpdateRequestProcessor; //导入依赖的package包/类
@Override
public void load(SolrQueryRequest req, 
    SolrQueryResponse rsp, 
    ContentStream stream, 
    UpdateRequestProcessor processor) throws Exception {
  
  Reader reader = null;
  try {
    reader = stream.getReader();
    if (log.isTraceEnabled()) {
      String body = IOUtils.toString(reader);
      log.trace("body", body);
      reader = new StringReader(body);
    }
  
    parser = new JSONParser(reader);
    this.processUpdate();
  }
  finally {
    IOUtils.closeQuietly(reader);
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:23,代码来源:JsonLoader.java

示例5: load

import org.apache.solr.update.processor.UpdateRequestProcessor; //导入依赖的package包/类
@Override
public void load(SolrQueryRequest req, SolrQueryResponse rsp,
    ContentStream stream, UpdateRequestProcessor processor) throws Exception {

  String type = req.getParams().get(UpdateParams.ASSUME_CONTENT_TYPE);
  if(type == null) {
    type = stream.getContentType();
  }
  if( type == null ) { // Normal requests will not get here.
    throw new SolrException(ErrorCode.UNSUPPORTED_MEDIA_TYPE, "Missing ContentType");
  }
  int idx = type.indexOf(';');
  if(idx>0) {
    type = type.substring(0,idx);
  }
  ContentStreamLoader loader = loaders.get(type);
  if(loader==null) {
    throw new SolrException(ErrorCode.UNSUPPORTED_MEDIA_TYPE, "Unsupported ContentType: "
        +type+ "  Not in: "+loaders.keySet());
  }
  if(loader.getDefaultWT()!=null) {
    setDefaultWT(req,loader);
  }
  loader.load(req, rsp, stream, processor);
}
 
开发者ID:europeana,项目名称:search,代码行数:26,代码来源:UpdateRequestHandler.java

示例6: deleteByQuery

import org.apache.solr.update.processor.UpdateRequestProcessor; //导入依赖的package包/类
private void deleteByQuery(String query) throws IOException
{
    SolrQueryRequest request = null;
    UpdateRequestProcessor processor = null;
    try
    {
        request = getLocalSolrQueryRequest();
        processor = this.core.getUpdateProcessingChain(null).createProcessor(request, new SolrQueryResponse());
        DeleteUpdateCommand delDocCmd = new DeleteUpdateCommand(request);
        delDocCmd.setQuery(query);
        processor.processDelete(delDocCmd);
    }
    finally
    {
        if(processor != null) {processor.finish();}
        if(request != null) {request.close();}
    }
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:19,代码来源:SolrInformationServer.java

示例7: ExtractingDocumentLoader

import org.apache.solr.update.processor.UpdateRequestProcessor; //导入依赖的package包/类
public ExtractingDocumentLoader(SolrQueryRequest req, UpdateRequestProcessor processor,
                         TikaConfig config, SolrContentHandlerFactory factory) {
  this.params = req.getParams();
  schema = req.getSchema();
  this.config = config;
  this.processor = processor;

  templateAdd = new AddUpdateCommand(req);
  templateAdd.overwrite = params.getBool(UpdateParams.OVERWRITE, true);
  templateAdd.commitWithin = params.getInt(UpdateParams.COMMIT_WITHIN, -1);

  //this is lightweight
  autoDetectParser = new AutoDetectParser(config);
  this.factory = factory;
  
  ignoreTikaException = params.getBool(ExtractingParams.IGNORE_TIKA_EXCEPTION, false);
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:18,代码来源:ExtractingDocumentLoader.java

示例8: getSolrWriter

import org.apache.solr.update.processor.UpdateRequestProcessor; //导入依赖的package包/类
private SolrWriter getSolrWriter(final UpdateRequestProcessor processor,
                                 final SolrResourceLoader loader, final RequestInfo requestParams, SolrQueryRequest req) {

  return new SolrWriter(processor, req) {

    @Override
    public boolean upload(SolrInputDocument document) {
      try {
        return super.upload(document);
      } catch (RuntimeException e) {
        LOG.error( "Exception while adding: " + document, e);
        return false;
      }
    }
  };
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:17,代码来源:DataImportHandler.java

示例9: load

import org.apache.solr.update.processor.UpdateRequestProcessor; //导入依赖的package包/类
@Override
public void load(SolrQueryRequest req, SolrQueryResponse rsp,
    ContentStream stream, UpdateRequestProcessor processor) throws Exception {
  
  String type = req.getParams().get(UpdateParams.ASSUME_CONTENT_TYPE);
  if(type == null) {
    type = stream.getContentType();
  }
  if( type == null ) { // Normal requests will not get here.
    throw new SolrException(ErrorCode.BAD_REQUEST, "Missing ContentType");
  }
  int idx = type.indexOf(';');
  if(idx>0) {
    type = type.substring(0,idx);
  }
  ContentStreamLoader loader = loaders.get(type);
  if(loader==null) {
    throw new SolrException(ErrorCode.BAD_REQUEST, "Unsupported ContentType: "
        +type+ "  Not in: "+loaders.keySet());
  }
  if(loader.getDefaultWT()!=null) {
    setDefaultWT(req,loader);
  }
  loader.load(req, rsp, stream, processor);
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:26,代码来源:UpdateRequestHandler.java

示例10: getInstance

import org.apache.solr.update.processor.UpdateRequestProcessor; //导入依赖的package包/类
@Override
public UpdateRequestProcessor getInstance(
		final SolrQueryRequest req, 
		final SolrQueryResponse res,
		UpdateRequestProcessor next) {
	return new RemoveFieldUpdateRequestProcessor(next);
}
 
开发者ID:agazzarini,项目名称:as-full-text-search-server,代码行数:8,代码来源:RemoveFieldUpdateRequestProcessorFactory.java

示例11: AutocompleteUpdateRequestProcessor

import org.apache.solr.update.processor.UpdateRequestProcessor; //导入依赖的package包/类
public AutocompleteUpdateRequestProcessor(SolrClient solrAC, List<String> fields, List<String> copyAsIsFields, String separator, UpdateRequestProcessor next) {
    super(next);
    this.solrAC = solrAC;
    this.fields = fields;
    this.copyAsIsFields = copyAsIsFields;
    this.separator = separator;
}
 
开发者ID:sematext,项目名称:solr-autocomplete,代码行数:8,代码来源:AutocompleteUpdateRequestProcessor.java

示例12: getInstance

import org.apache.solr.update.processor.UpdateRequestProcessor; //导入依赖的package包/类
@Override
public UpdateRequestProcessor getInstance(SolrQueryRequest req, SolrQueryResponse rsp,
        UpdateRequestProcessor nextURP) {
    if (this.solrACServer == null) {
        // Used with embedded Solr AC core; when AC core is deployed on same Solr and 'main index'
        this.solrACServer = new EmbeddedSolrServer(core.getCoreContainer(), solrAC);
    }

    return new AutocompleteUpdateRequestProcessor(solrACServer, fields, copyAsIsFields, separator, nextURP);
}
 
开发者ID:sematext,项目名称:solr-autocomplete,代码行数:11,代码来源:AutocompleteUpdateRequestProcessorFactory.java

示例13: FusionUpdateProcessor

import org.apache.solr.update.processor.UpdateRequestProcessor; //导入依赖的package包/类
public FusionUpdateProcessor(SolrParams params,
                             SolrQueryRequest solrQueryRequest,
                             SolrQueryResponse solrQueryResponse,
                             UpdateRequestProcessor next) {
  super(next);
  this.init(params);
  inputFactory = XMLInputFactory.newInstance();
}
 
开发者ID:lucidworks,项目名称:fusion-solr-plugins,代码行数:9,代码来源:FusionUpdateProcessor.java

示例14: handleRequestBody

import org.apache.solr.update.processor.UpdateRequestProcessor; //导入依赖的package包/类
/**
 * Processes the request for the round robin update update handler.
 *
 * @param req - the solr query request information
 * @param rsp - the solr query response information
 * @throws ParseException,IOException,SyntaxError - if bad things happen
 */
@Override
public void handleRequestBody(SolrQueryRequest req, SolrQueryResponse rsp) throws ParseException, IOException, SyntaxError {
    String deletionQuery = getDeletionQuery();
    LOGGER.info("Handle deletion request for query {}", deletionQuery);

    if (olderDocumentsExists(deletionQuery, req, rsp)) {
        UpdateRequestProcessor processor = getProcessor(req, rsp);
        deleteOldDocuments(deletionQuery, processor, req);
        commitDeletions(processor, req);
    }
}
 
开发者ID:ChronixDB,项目名称:chronix.server,代码行数:19,代码来源:ChronixRetentionHandler.java

示例15: handleRequestBody

import org.apache.solr.update.processor.UpdateRequestProcessor; //导入依赖的package包/类
@Override
@SuppressWarnings("PMD.SignatureDeclareThrowsException")
public void handleRequestBody(SolrQueryRequest req, SolrQueryResponse rsp) throws Exception {
    formatResponseAsJson(req);

    if (req.getContentStreams() == null) {
        LOGGER.warn("no content stream");
        rsp.add("error", "No content stream");
        return;
    }

    boolean commit = Boolean.parseBoolean(req.getParams().get("commit", "true"));

    InputStream stream = req.getContentStreams().iterator().next().getStream();
    stream = detectGzip(stream);

    MetricTimeSeriesConverter converter = new MetricTimeSeriesConverter();

    UpdateRequestProcessorChain processorChain = req.getCore().getUpdateProcessorChain(req.getParams());
    UpdateRequestProcessor processor = processorChain.createProcessor(req, rsp);
    try {
        for (MetricTimeSeries series : formatParser.parse(stream)) {
            SolrInputDocument document = new SolrInputDocument();
            converter.to(series).getFields().forEach(document::addField);
            storeDocument(document, processor, req);
        }

        if (commit) {
            LOGGER.debug("Committing transaction...");
            processor.processCommit(new CommitUpdateCommand(req, false));
            LOGGER.debug("Committed transaction");
        } else {
            LOGGER.debug("Only adding documents.");
        }
    } finally {
        processor.finish();
    }
}
 
开发者ID:ChronixDB,项目名称:chronix.server,代码行数:39,代码来源:AbstractIngestionHandler.java


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