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


Java CloudSolrClient.setParser方法代码示例

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


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

示例1: getCollections

import org.apache.solr.client.solrj.impl.CloudSolrClient; //导入方法依赖的package包/类
/**
 * Get target cores via CollectionsAPI.
 *
 * @param cloudSolrClient
 * @return
 */
public static List<String> getCollections(CloudSolrClient cloudSolrClient) throws SolrServerException, IOException {
    List<String> collections = new ArrayList<>();

    NoOpResponseParser responseParser = new NoOpResponseParser();
    responseParser.setWriterType("json");

    cloudSolrClient.setParser(responseParser);

    CollectionAdminRequest collectionAdminRequest = new CollectionAdminRequest.List();

    NamedList<Object> collectionAdminResponse = cloudSolrClient.request(collectionAdminRequest);

    JsonNode collectionsJsonNode = om.readTree((String) collectionAdminResponse.get("response")).get("collections");

    for (Iterator<JsonNode> i = collectionsJsonNode.iterator(); i.hasNext(); ) {
        String collection = i.next().textValue();
        if (!collections.contains(collection)) {
            collections.add(collection);
        }
    }

    return collections;
}
 
开发者ID:mosuka,项目名称:solr-exporter,代码行数:30,代码来源:SolrCollector.java

示例2: getBaseUrls

import org.apache.solr.client.solrj.impl.CloudSolrClient; //导入方法依赖的package包/类
/**
 * Get base urls via CollectionsAPI.
 *
 * @param cloudSolrClient
 * @return
 */
private List<String> getBaseUrls(CloudSolrClient cloudSolrClient) throws SolrServerException, IOException {
    List<String> baseUrls = new ArrayList<>();

    NoOpResponseParser responseParser = new NoOpResponseParser();
    responseParser.setWriterType("json");

    cloudSolrClient.setParser(responseParser);

    CollectionAdminRequest collectionAdminRequest = new CollectionAdminRequest.ClusterStatus();

    NamedList<Object> collectionAdminResponse = cloudSolrClient.request(collectionAdminRequest);

    List<JsonNode> baseUrlJsonNode = om.readTree((String) collectionAdminResponse.get("response")).findValues("base_url");

    for (Iterator<JsonNode> i = baseUrlJsonNode.iterator(); i.hasNext(); ) {
        String baseUrl = i.next().textValue();
        if (!baseUrls.contains(baseUrl)) {
            baseUrls.add(baseUrl);
        }
    }

    return baseUrls;
}
 
开发者ID:mosuka,项目名称:solr-exporter,代码行数:30,代码来源:SolrCollector.java

示例3: fromZookeeperHosts

import org.apache.solr.client.solrj.impl.CloudSolrClient; //导入方法依赖的package包/类
public static SolrClient fromZookeeperHosts(String zkHostsCommaSeparated, String zkChroot) {
    CloudSolrClient.Builder b =
        new CloudSolrClient.Builder().withZkHost(Arrays.asList(zkHostsCommaSeparated.split(",")));
    if (zkChroot != null && zkChroot.length() > 0) {
        b.withZkChroot(zkChroot);
    }
    CloudSolrClient csc = b.build();
    csc.setParser(new InputStreamResponseParser("json"));
    return csc;
}
 
开发者ID:jdyer1,项目名称:R-solr-stream,代码行数:11,代码来源:SolrClientFactory.java

示例4: getCloudSolrClient

import org.apache.solr.client.solrj.impl.CloudSolrClient; //导入方法依赖的package包/类
private SolrClient getCloudSolrClient() {

        LOG.debug("Creating CloudSolrClient using ZooKeeper: '{}'", solrZKHost);

        CloudSolrClient client =  new CloudSolrClient(solrZKHost);
        client.setParser(new XMLResponseParser());

        return client;
    }
 
开发者ID:headwirecom,项目名称:aem-solr-search,代码行数:10,代码来源:SolrConfigurationService.java


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