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


Java BinaryRequestWriter类代码示例

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


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

示例1: getNewHttpSolrServer

import org.apache.solr.client.solrj.impl.BinaryRequestWriter; //导入依赖的package包/类
/**
 * 
 * @param indexUrl
 * @return
 */
public static HttpSolrServer getNewHttpSolrServer(String indexUrl) {
    if (indexUrl == null) {
        throw new IllegalArgumentException("indexUrl may not be null");
    }
    HttpSolrServer server = new HttpSolrServer(indexUrl);
    server.setSoTimeout(TIMEOUT_SO); // socket read timeout
    server.setConnectionTimeout(TIMEOUT_CONNECTION);
    server.setDefaultMaxConnectionsPerHost(100);
    server.setMaxTotalConnections(100);
    server.setFollowRedirects(false); // defaults to false
    server.setAllowCompression(true);
    server.setMaxRetries(1); // defaults to 0. > 1 not recommended.
    // server.setParser(new XMLResponseParser()); // binary parser is used by default
    server.setRequestWriter(new BinaryRequestWriter());

    return server;
}
 
开发者ID:intranda,项目名称:goobi-viewer-connector,代码行数:23,代码来源:SolrSearchIndex.java

示例2: createNewSolrServer

import org.apache.solr.client.solrj.impl.BinaryRequestWriter; //导入依赖的package包/类
@Override
public SolrServer createNewSolrServer()
{
  try {
    // setup the server...
    String url = jetty.getBaseUrl().toString() + "/collection1";
    HttpSolrServer s = new HttpSolrServer( url );
    s.setConnectionTimeout(DEFAULT_CONNECTION_TIMEOUT);
    s.setDefaultMaxConnectionsPerHost(100);
    s.setMaxTotalConnections(100);
    s.setUseMultiPartPost(random().nextBoolean());

    // where the magic happens
    s.setParser(new BinaryResponseParser());
    s.setRequestWriter(new BinaryRequestWriter());

    return s;
  }
  catch( Exception ex ) {
    throw new RuntimeException( ex );
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:23,代码来源:SolrExampleBinaryTest.java

示例3: createNewSolrServer

import org.apache.solr.client.solrj.impl.BinaryRequestWriter; //导入依赖的package包/类
@Override
public SolrServer createNewSolrServer() {
  try {
    // setup the server...
    String url = jetty.getBaseUrl().toString() + "/collection1";
    HttpSolrServer s = new HttpSolrServer(url);
    s.setConnectionTimeout(DEFAULT_CONNECTION_TIMEOUT);
    s.setDefaultMaxConnectionsPerHost(100);
    s.setMaxTotalConnections(100);
    s.setUseMultiPartPost(random().nextBoolean());
    
    if (random().nextBoolean()) {
      s.setParser(new BinaryResponseParser());
      s.setRequestWriter(new BinaryRequestWriter());
    }
    
    return s;
  } catch (Exception ex) {
    throw new RuntimeException(ex);
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:22,代码来源:SolrSchemalessExampleTests.java

示例4: createNewSolrServer

import org.apache.solr.client.solrj.impl.BinaryRequestWriter; //导入依赖的package包/类
@Override
public SolrServer createNewSolrServer()
{
  try {
    // setup the server...
    String url = jetty.getBaseUrl().toString();
    HttpSolrServer s = new HttpSolrServer( url );
    s.setConnectionTimeout(DEFAULT_CONNECTION_TIMEOUT);
    s.setDefaultMaxConnectionsPerHost(100);
    s.setMaxTotalConnections(100);

    // where the magic happens
    s.setParser(new BinaryResponseParser());
    s.setRequestWriter(new BinaryRequestWriter());

    return s;
  }
  catch( Exception ex ) {
    throw new RuntimeException( ex );
  }
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:22,代码来源:SolrExampleBinaryTest.java

示例5: getNewHttpSolrServer

import org.apache.solr.client.solrj.impl.BinaryRequestWriter; //导入依赖的package包/类
public static HttpSolrServer getNewHttpSolrServer(String confFilename) throws FatalIndexerException {
    HttpSolrServer server = new HttpSolrServer(Configuration.getInstance(confFilename).getConfiguration("solrUrl"));
    server.setSoTimeout(TIMEOUT_SO); // socket read timeout
    server.setConnectionTimeout(TIMEOUT_CONNECTION);
    server.setDefaultMaxConnectionsPerHost(100);
    server.setMaxTotalConnections(100);
    server.setFollowRedirects(false); // defaults to false
    server.setAllowCompression(true);
    server.setMaxRetries(1); // defaults to 0. > 1 not recommended.
    // server.setParser(new XMLResponseParser()); // binary parser is used by default
    server.setRequestWriter(new BinaryRequestWriter());

    return server;
}
 
开发者ID:intranda,项目名称:goobi-viewer-indexer,代码行数:15,代码来源:SolrHelper.java

示例6: streamWithHttpSolrClient

import org.apache.solr.client.solrj.impl.BinaryRequestWriter; //导入依赖的package包/类
/**
 * Fetches a stream of time series only from a single node with HttpSolrClient.
 *
 * @param shardUrl
 * @param query
 * @param converter
 * @return
 */
private Stream<MetricTimeSeries> streamWithHttpSolrClient(String shardUrl,
                                                          SolrQuery query,
                                                          TimeSeriesConverter<MetricTimeSeries> converter) {
    HttpSolrClient solrClient = getSingleNodeSolrClient(shardUrl);
    solrClient.setRequestWriter(new BinaryRequestWriter());
    query.set("distrib", false);
    LoggerFactory.getLogger(ChronixSolrCloudStorage.class).debug("Streaming data from solr using converter {}, Solr Client {}, and Solr Query {}", converter, solrClient, query);
    SolrStreamingService<MetricTimeSeries> solrStreamingService = new SolrStreamingService<>(converter, query, solrClient, nrOfDocumentPerBatch);
    return StreamSupport.stream(Spliterators.spliteratorUnknownSize(solrStreamingService, Spliterator.SIZED), false);
}
 
开发者ID:ChronixDB,项目名称:chronix.spark,代码行数:19,代码来源:ChronixSolrCloudStorage.java

示例7: createNewSolrServer

import org.apache.solr.client.solrj.impl.BinaryRequestWriter; //导入依赖的package包/类
@Override
public SolrServer createNewSolrServer() {
  ConcurrentUpdateSolrServer s = (ConcurrentUpdateSolrServer)super.createNewSolrServer();
  s.setParser(new BinaryResponseParser());
  s.setRequestWriter(new BinaryRequestWriter());
  return s;
}
 
开发者ID:europeana,项目名称:search,代码行数:8,代码来源:SolrExampleStreamingBinaryTest.java

示例8: testWithBinary

import org.apache.solr.client.solrj.impl.BinaryRequestWriter; //导入依赖的package包/类
@Test
public void testWithBinary()throws Exception{
  HttpSolrServer httpSolrServer = (HttpSolrServer) getSolrServer();
  httpSolrServer.setRequestWriter(new BinaryRequestWriter());
  httpSolrServer.deleteByQuery( "*:*" ); // delete everything!
  doIt(httpSolrServer);
}
 
开发者ID:europeana,项目名称:search,代码行数:8,代码来源:TestBatchUpdate.java

示例9: testWithBinaryBean

import org.apache.solr.client.solrj.impl.BinaryRequestWriter; //导入依赖的package包/类
@Test
public void testWithBinaryBean()throws Exception{
  HttpSolrServer httpSolrServer = (HttpSolrServer) getSolrServer();
  httpSolrServer.setRequestWriter(new BinaryRequestWriter());
  httpSolrServer.deleteByQuery( "*:*" ); // delete everything!
  final int[] counter = new int[1];
  counter[0] = 0;
  httpSolrServer.addBeans(new Iterator<Bean>() {

    @Override
    public boolean hasNext() {
      return counter[0] < numdocs;
    }

    @Override
    public Bean next() {
      Bean bean = new Bean();
      bean.id = "" + (++counter[0]);
      bean.cat = "foocat";
      return bean;
    }

    @Override
    public void remove() {
      //do nothing
    }
  });
  httpSolrServer.commit();
  SolrQuery query = new SolrQuery("*:*");
  QueryResponse response = httpSolrServer.query(query);
  assertEquals(0, response.getStatus());
  assertEquals(numdocs, response.getResults().getNumFound());
}
 
开发者ID:europeana,项目名称:search,代码行数:34,代码来源:TestBatchUpdate.java

示例10: getSolrServer

import org.apache.solr.client.solrj.impl.BinaryRequestWriter; //导入依赖的package包/类
/**
 * Gets the instance of the Apache Solr server used for indexing.
 *
 * @return Instance of the Apache Solr server
 * @throws IllegalStateException If the search engine is not properly
 * configured
 */
private SolrServer getSolrServer() {
    try {
        String url = cfgService.getString(ConfigurationKey.SEARCH_ENGINE_URL);
        Integer socketTimeout = cfgService.getInteger(ConfigurationKey.SEARCH_ENGINE_SOCKET_TIMEOUT);
        Integer connectionTimeout = cfgService.getInteger(ConfigurationKey.SEARCH_ENGINE_CONNECTION_TIMEOUT);
        Integer maxTotalConnectionsPerHost = cfgService.getInteger(ConfigurationKey.SEARCH_ENGINE_MAX_TOTAL_CONNECTIONS_PER_HOST);
        Integer maxTotalConnections = cfgService.getInteger(ConfigurationKey.SEARCH_ENGINE_MAX_TOTAL_CONNECTIONS);
        Integer maxRetries = cfgService.getInteger(ConfigurationKey.SEARCH_ENGINE_MAX_RETRIES);
        Boolean followRedirects = cfgService.getBoolean(ConfigurationKey.SEARCH_ENGINE_FOLLOW_REDIRECTS);
        Boolean allowCompression = cfgService.getBoolean(ConfigurationKey.SEARCH_ENGINE_ALLOW_COMPRESSION);

        CommonsHttpSolrServer solrServer = new CommonsHttpSolrServer(url);
        solrServer.setRequestWriter(new BinaryRequestWriter());
        solrServer.setSoTimeout(socketTimeout);
        solrServer.setConnectionTimeout(connectionTimeout);
        solrServer.setDefaultMaxConnectionsPerHost(maxTotalConnectionsPerHost);
        solrServer.setMaxTotalConnections(maxTotalConnections);
        solrServer.setFollowRedirects(followRedirects);
        solrServer.setAllowCompression(allowCompression);
        solrServer.setMaxRetries(maxRetries);

        return solrServer;
    } catch (MalformedURLException ex) {
        LOG.log(Level.SEVERE, "Invalid search engine configuration. {0}", ex.getMessage());
        LOG.log(Level.FINEST, "", ex);
        throw new IllegalStateException("Invalid search engine configuration", ex);
    }
}
 
开发者ID:getconverge,项目名称:converge-1.x,代码行数:36,代码来源:SearchEngineBean.java

示例11: init

import org.apache.solr.client.solrj.impl.BinaryRequestWriter; //导入依赖的package包/类
public void init() {
	HttpClientBuilder clientBuilder = HttpClientBuilder.create(); 
	httpClient = clientBuilder.build();
	searchServer = new HttpSolrServer(solrUrl, httpClient);
	searchServer.setRequestWriter(new BinaryRequestWriter());
	updateServer = new ConcurrentUpdateSolrServer(solrUrl, 5000, 10);
	updateServer.setRequestWriter(new BinaryRequestWriter());
}
 
开发者ID:mhinters,项目名称:BannedBookUtils,代码行数:9,代码来源:SolrClient.java

示例12: testWithBinary

import org.apache.solr.client.solrj.impl.BinaryRequestWriter; //导入依赖的package包/类
@Test
public void testWithBinary()throws Exception{
  HttpSolrServer commonsHttpSolrServer = (HttpSolrServer) getSolrServer();
  commonsHttpSolrServer.setRequestWriter(new BinaryRequestWriter());
  commonsHttpSolrServer.deleteByQuery( "*:*" ); // delete everything!
  doIt(commonsHttpSolrServer);
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:8,代码来源:TestBatchUpdate.java

示例13: testWithBinaryBean

import org.apache.solr.client.solrj.impl.BinaryRequestWriter; //导入依赖的package包/类
@Test
public void testWithBinaryBean()throws Exception{
  HttpSolrServer commonsHttpSolrServer = (HttpSolrServer) getSolrServer();
  commonsHttpSolrServer.setRequestWriter(new BinaryRequestWriter());
  commonsHttpSolrServer.deleteByQuery( "*:*" ); // delete everything!
  final int[] counter = new int[1];
  counter[0] = 0;
  commonsHttpSolrServer.addBeans(new Iterator<Bean>() {

    @Override
    public boolean hasNext() {
      return counter[0] < numdocs;
    }

    @Override
    public Bean next() {
      Bean bean = new Bean();
      bean.id = "" + (++counter[0]);
      bean.cat = "foocat";
      return bean;
    }

    @Override
    public void remove() {
      //do nothing
    }
  });
  commonsHttpSolrServer.commit();
  SolrQuery query = new SolrQuery("*:*");
  QueryResponse response = commonsHttpSolrServer.query(query);
  assertEquals(0, response.getStatus());
  assertEquals(numdocs, response.getResults().getNumFound());
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:34,代码来源:TestBatchUpdate.java

示例14: SolrJConnector

import org.apache.solr.client.solrj.impl.BinaryRequestWriter; //导入依赖的package包/类
public SolrJConnector(String serverUrl) {
    try {
        solrServer = new HttpSolrServer(serverUrl);
        solrServer.setRequestWriter(new BinaryRequestWriter()); //To avoid http error code 413/414, due to monster URI. (and it is faster)
    } catch (Exception e) {
        System.out.println("Unable to connect to:" + serverUrl);
        e.printStackTrace();
        log.error("Unable to connect to to:" + serverUrl, e);
    }
}
 
开发者ID:statsbiblioteket,项目名称:newspaper-batch-event-framework,代码行数:11,代码来源:SolrJConnector.java

示例15: SolrServerClient

import org.apache.solr.client.solrj.impl.BinaryRequestWriter; //导入依赖的package包/类
public SolrServerClient (String serverUrl){
    try{           
        solrServer = new HttpSolrServer(serverUrl);
        solrServer.setRequestWriter(new BinaryRequestWriter()); //To avoid http error code 413/414, due to monster URI. (and it is faster)                
    }
    catch(Exception e){            
        log.error("Unable to connect to solr-server:"+serverUrl,e);
    }


}
 
开发者ID:statsbiblioteket,项目名称:licensemodule,代码行数:12,代码来源:SolrServerClient.java


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