• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Hit类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: elasticSearch

import io.searchbox.core.SearchResult.Hit; //导入依赖的package包/类
private static void elasticSearch(JestClient client, String indexName, String type, String query) {
	SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
	QueryStringQueryBuilder queryStringQueryBuilder = QueryBuilders.queryStringQuery(query);
	searchSourceBuilder.query(queryStringQueryBuilder);
	Search searchElastic = (Search) new Search.Builder(searchSourceBuilder.toString())
			// multiple index or types can be added.
			.addIndex(indexName).addType(type).build();

	try {
		SearchResult elasticRs = client.execute(searchElastic);

		List<Hit<Article, Void>> hits = elasticRs.getHits(Article.class);
		for (Hit<Article, Void> hit : hits) {
			Article talk = hit.source;
			System.out.println("Elastic hits: " + talk.toString());
		}
	} catch (IOException e) {
		e.printStackTrace();
	}
}
 
开发者ID:conorheffron,项目名称:elastic-tester,代码行数:21,代码来源:ElasticApp.java


示例2: jestSearchModel

import io.searchbox.core.SearchResult.Hit; //导入依赖的package包/类
private static void jestSearchModel(JestClient client, String indexName, String type, String query) {
	Search.Builder searchBuilder = new Search.Builder(query).addIndex(indexName).addType(type);
	try {
		SearchResult result = client.execute(searchBuilder.build());

		System.out.println(result.getJsonObject());

		List<Hit<Article, Void>> hits = result.getHits(Article.class);
		for (Hit<Article, Void> hit : hits) {
			Article talk = hit.source;
			System.out.println("JEST Search model hit: " + talk.toString());
		}

	} catch (IOException e) {
		e.printStackTrace();
	}
}
 
开发者ID:conorheffron,项目名称:elastic-tester,代码行数:18,代码来源:ElasticApp.java


示例3: testQuery

import io.searchbox.core.SearchResult.Hit; //导入依赖的package包/类
@Test
@Ignore
public void testQuery() throws Exception {
	SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
    FilterBuilder filter = FilterBuilders.boolFilter()
            .must(FilterBuilders.termFilter("attributes.league", "Flashback Event HC (IC002)"))
            .must(FilterBuilders.termFilter("attributes.equipType", "Jewel"))
            .must(FilterBuilders.rangeFilter("modsTotal.#% increased maximum Life").gt(4))
            .must(FilterBuilders.termFilter("shop.verified", "yes"))
           // .must(FilterBuilders.termFilter("attributes.rarity", "Magic"))
            ;

    searchSourceBuilder
            .query(QueryBuilders.filteredQuery(QueryBuilders.boolQuery().minimumNumberShouldMatch(2)
                    .should(QueryBuilders.rangeQuery("modsTotal.#% increased Area Damage"))
                    .should(QueryBuilders.rangeQuery("modsTotal.#% increased Projectile Damage"))
                    .should(QueryBuilders.rangeQuery("modsTotal.#% increased Chaos Damage")), filter))
            .sort("_score");
    SearchResult result = client.execute(searchSourceBuilder.toString()).getSearchResult();
	List<Hit<ExileToolsHit, Void>> hits = result.getHits(ExileToolsHit.class);
	hits.stream().map(hit -> hit.source).forEach(System.out::println);
}
 
开发者ID:thirdy,项目名称:blackmarket,代码行数:23,代码来源:ExileToolsSearchClientTest.java


示例4: testExecuteMjolnerUsingFilters

import io.searchbox.core.SearchResult.Hit; //导入依赖的package包/类
/**
	 * As per ES documentation/tome, the best way to do our search is via Filters
	 */
	@Test
	@Ignore
	public void testExecuteMjolnerUsingFilters() throws Exception {
		SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
		List<FilterBuilder> filters = new LinkedList<>();
		
		filters.add(FilterBuilders.termFilter("attributes.league", "Flashback Event (IC001)"));
//		filters.add(FilterBuilders.termFilter("info.name", "Mjolner"));
		filters.add(FilterBuilders.termFilter("info.name", "Hegemony's Era"));
		filters.add(FilterBuilders.rangeFilter("properties.Weapon.Physical DPS").from(400));
		
		FilterBuilder filter = FilterBuilders.andFilter(filters.toArray(new FilterBuilder[filters.size()]));
		searchSourceBuilder.query(QueryBuilders.filteredQuery(null, filter));
		searchSourceBuilder.size(100);
		SearchResult result = client.execute(searchSourceBuilder.toString()).getSearchResult();
		List<Hit<ExileToolsHit, Void>> hits = result.getHits(ExileToolsHit.class);
		for (Hit<ExileToolsHit, Void> hit : hits) {
//			logger.info(hit.source.toString());
//			hit.source.getQuality().ifPresent( q -> logger.info(q.toString()) );
			hit.source.getPhysicalDPS().ifPresent( q -> logger.info(q.toString()) );
//			logger.info(hit.source.toString());
//			logger.info(hit.source.getRequirements().getLevel().toString());
//			logger.info(hit.source.getExplicitMods().toString());
		}
	}
 
开发者ID:thirdy,项目名称:blackmarket,代码行数:29,代码来源:ExileToolsSearchClientTest.java


示例5: testShops

import io.searchbox.core.SearchResult.Hit; //导入依赖的package包/类
@Test
@Ignore
public void testShops() throws Exception {
	SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
	searchSourceBuilder.query(QueryBuilders.boolQuery()
			.must(QueryBuilders.matchQuery("attributes.league", "Flashback Event (IC001)"))
			.mustNot(QueryBuilders.matchQuery("attributes.league", "Flashback Event (IC001)")
					));
	searchSourceBuilder.size(1);
	
	SearchResult result = client.execute(searchSourceBuilder.toString()).getSearchResult();
	List<Hit<ExileToolsHit, Void>> hits = result.getHits(ExileToolsHit.class);
	for (Hit<ExileToolsHit, Void> hit : hits) {
		logger.info(hit.source.toString());
	}
}
 
开发者ID:thirdy,项目名称:blackmarket,代码行数:17,代码来源:ExileToolsSearchClientTest.java


示例6: searchAll

import io.searchbox.core.SearchResult.Hit; //导入依赖的package包/类
/**
 * 查询全部
 * @throws Exception
 */
private static void searchAll() throws Exception {
	JestClient jestClient = JestExample.getJestClient();
	SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
	searchSourceBuilder.query(QueryBuilders.matchAllQuery());
	Search search = new Search.Builder(searchSourceBuilder.toString())
			.addIndex("article")
			.build();
	SearchResult result = jestClient.execute(search);
	System.out.println("本次查询共查到:"+result.getTotal()+"篇文章!");
	List<Hit<Article,Void>> hits = result.getHits(Article.class);
	for (Hit<Article, Void> hit : hits) {
		Article source = hit.source;
		System.out.println("标题:"+source.getTitle());
		System.out.println("内容:"+source.getContent());
		System.out.println("url:"+source.getUrl());
		System.out.println("来源:"+source.getSource());
		System.out.println("作者:"+source.getAuthor());
	}
}
 
开发者ID:ameizi,项目名称:elasticsearch-jest-example,代码行数:24,代码来源:JestExample.java


示例7: getPlugin

import io.searchbox.core.SearchResult.Hit; //导入依赖的package包/类
/**
 * @see io.apiman.manager.api.core.IStorage#getPlugin(java.lang.String, java.lang.String)
 */
@Override
public PluginBean getPlugin(String groupId, String artifactId) throws StorageException {
    try {
        @SuppressWarnings("nls")
        QueryBuilder qb = QueryBuilders.filteredQuery(
                QueryBuilders.matchAllQuery(),
                FilterBuilders.andFilter(
                        FilterBuilders.termFilter("groupId", groupId),
                        FilterBuilders.termFilter("artifactId", artifactId)
                )
            );
        SearchSourceBuilder builder = new SearchSourceBuilder().query(qb).size(2);
        List<Hit<Map<String,Object>,Void>> hits = listEntities("plugin", builder); //$NON-NLS-1$
        if (hits.size() == 1) {
            Hit<Map<String,Object>,Void> hit = hits.iterator().next();
            return EsMarshalling.unmarshallPlugin(hit.source);
        }
        return null;
    } catch (Exception e) {
        throw new StorageException(e);
    }
}
 
开发者ID:apiman,项目名称:apiman,代码行数:26,代码来源:EsStorage.java


示例8: listPlugins

import io.searchbox.core.SearchResult.Hit; //导入依赖的package包/类
/**
 * @see io.apiman.manager.api.core.IStorageQuery#listPlugins()
 */
@Override
public List<PluginSummaryBean> listPlugins() throws StorageException {
    @SuppressWarnings("nls")
    String[] fields = {"id", "artifactId", "groupId", "version", "classifier", "type", "name",
        "description", "createdBy", "createdOn"};

    @SuppressWarnings("nls")
    QueryBuilder query = QueryBuilders.filteredQuery(
        QueryBuilders.matchAllQuery(),
        FilterBuilders.orFilter(
                FilterBuilders.missingFilter("deleted"),
                FilterBuilders.termFilter("deleted", false))
    );
    SearchSourceBuilder builder = new SearchSourceBuilder()
            .fetchSource(fields, null).query(query).sort("name.raw", SortOrder.ASC).size(200); //$NON-NLS-1$
    List<Hit<Map<String,Object>,Void>> hits = listEntities("plugin", builder); //$NON-NLS-1$
    List<PluginSummaryBean> rval = new ArrayList<>(hits.size());
    for (Hit<Map<String,Object>,Void> hit : hits) {
        PluginSummaryBean bean = EsMarshalling.unmarshallPluginSummary(hit.source);
        rval.add(bean);
    }
    return rval;
}
 
开发者ID:apiman,项目名称:apiman,代码行数:27,代码来源:EsStorage.java


示例9: getOrgs

import io.searchbox.core.SearchResult.Hit; //导入依赖的package包/类
/**
 * @see io.apiman.manager.api.core.IStorageQuery#getOrgs(java.util.Set)
 */
@Override
public List<OrganizationSummaryBean> getOrgs(Set<String> organizationIds) throws StorageException {
    List<OrganizationSummaryBean> orgs = new ArrayList<>();
    if (organizationIds == null || organizationIds.isEmpty()) {
        return orgs;
    }
    @SuppressWarnings("nls")
    QueryBuilder query = QueryBuilders.filteredQuery(
        QueryBuilders.matchAllQuery(),
        FilterBuilders.termsFilter("id", organizationIds.toArray(new String[organizationIds.size()]))
    );
    @SuppressWarnings("nls")
    SearchSourceBuilder builder = new SearchSourceBuilder()
            .sort("name.raw", SortOrder.ASC)
            .query(query)
            .size(500);
    List<Hit<Map<String,Object>,Void>> hits = listEntities("organization", builder); //$NON-NLS-1$
    List<OrganizationSummaryBean> rval = new ArrayList<>(hits.size());
    for (Hit<Map<String,Object>,Void> hit : hits) {
        OrganizationSummaryBean bean = EsMarshalling.unmarshallOrganizationSummary(hit.source);
        rval.add(bean);
    }
    return rval;
}
 
开发者ID:apiman,项目名称:apiman,代码行数:28,代码来源:EsStorage.java


示例10: getClientsInOrgs

import io.searchbox.core.SearchResult.Hit; //导入依赖的package包/类
/**
 * @see io.apiman.manager.api.core.IStorageQuery#getClientsInOrgs(java.util.Set)
 */
@Override
public List<ClientSummaryBean> getClientsInOrgs(Set<String> organizationIds) throws StorageException {
    @SuppressWarnings("nls")
    SearchSourceBuilder builder = new SearchSourceBuilder()
            .sort("organizationName.raw", SortOrder.ASC)
            .sort("name.raw", SortOrder.ASC)
            .size(500);
    TermsQueryBuilder query = QueryBuilders.termsQuery("organizationId", organizationIds.toArray(new String[organizationIds.size()])); //$NON-NLS-1$
    builder.query(query);
    List<Hit<Map<String,Object>,Void>> hits = listEntities("client", builder); //$NON-NLS-1$
    List<ClientSummaryBean> rval = new ArrayList<>(hits.size());
    for (Hit<Map<String,Object>,Void> hit : hits) {
        ClientSummaryBean bean = EsMarshalling.unmarshallClientSummary(hit.source);
        rval.add(bean);
    }
    return rval;
}
 
开发者ID:apiman,项目名称:apiman,代码行数:21,代码来源:EsStorage.java


示例11: getClientVersions

import io.searchbox.core.SearchResult.Hit; //导入依赖的package包/类
/**
 * @see io.apiman.manager.api.core.IStorageQuery#getClientVersions(java.lang.String, java.lang.String)
 */
@Override
public List<ClientVersionSummaryBean> getClientVersions(String organizationId,
        String clientId) throws StorageException {
    @SuppressWarnings("nls")
    QueryBuilder query = QueryBuilders.filteredQuery(
        QueryBuilders.matchAllQuery(),
        FilterBuilders.andFilter(
                FilterBuilders.termFilter("organizationId", organizationId),
                FilterBuilders.termFilter("clientId", clientId))
    );
    @SuppressWarnings("nls")
    SearchSourceBuilder builder = new SearchSourceBuilder()
            .sort("createdOn", SortOrder.DESC)
            .query(query)
            .size(500);
    List<Hit<Map<String,Object>,Void>> hits = listEntities("clientVersion", builder); //$NON-NLS-1$
    List<ClientVersionSummaryBean> rval = new ArrayList<>(hits.size());
    for (Hit<Map<String,Object>,Void> hit : hits) {
        ClientVersionSummaryBean bean = EsMarshalling.unmarshallClientVersionSummary(hit.source);
        rval.add(bean);
    }
    return rval;
}
 
开发者ID:apiman,项目名称:apiman,代码行数:27,代码来源:EsStorage.java


示例12: getClientContracts

import io.searchbox.core.SearchResult.Hit; //导入依赖的package包/类
/**
 * @see io.apiman.manager.api.core.IStorageQuery#getClientContracts(java.lang.String, java.lang.String, java.lang.String)
 */
@Override
public List<ContractSummaryBean> getClientContracts(String organizationId, String clientId,
        String version) throws StorageException {
    @SuppressWarnings("nls")
    QueryBuilder query = QueryBuilders.filteredQuery(
        QueryBuilders.matchAllQuery(),
        FilterBuilders.andFilter(
            FilterBuilders.termFilter("clientOrganizationId", organizationId),
            FilterBuilders.termFilter("clientId", clientId),
            FilterBuilders.termFilter("clientVersion", version)
        )
    );
    @SuppressWarnings("nls")
    SearchSourceBuilder builder = new SearchSourceBuilder().sort("apiOrganizationId", SortOrder.ASC)
            .sort("apiId", SortOrder.ASC).query(query).size(500);
    List<Hit<Map<String,Object>,Void>> hits = listEntities("contract", builder); //$NON-NLS-1$
    List<ContractSummaryBean> rval = new ArrayList<>(hits.size());
    for (Hit<Map<String,Object>,Void> hit : hits) {
        ContractSummaryBean bean = EsMarshalling.unmarshallContractSummary(hit.source);
        rval.add(bean);
    }
    return rval;
}
 
开发者ID:apiman,项目名称:apiman,代码行数:27,代码来源:EsStorage.java


示例13: getApisInOrgs

import io.searchbox.core.SearchResult.Hit; //导入依赖的package包/类
/**
 * @see io.apiman.manager.api.core.IStorageQuery#getApisInOrgs(java.util.Set)
 */
@Override
public List<ApiSummaryBean> getApisInOrgs(Set<String> organizationIds) throws StorageException {
    @SuppressWarnings("nls")
    SearchSourceBuilder builder = new SearchSourceBuilder()
            .sort("organizationName.raw", SortOrder.ASC)
            .sort("name.raw", SortOrder.ASC)
            .size(500);
    TermsQueryBuilder query = QueryBuilders.termsQuery("organizationId", organizationIds.toArray(new String[organizationIds.size()])); //$NON-NLS-1$
    builder.query(query);

    List<Hit<Map<String,Object>,Void>> hits = listEntities("api", builder); //$NON-NLS-1$
    List<ApiSummaryBean> rval = new ArrayList<>(hits.size());
    for (Hit<Map<String,Object>,Void> hit : hits) {
        ApiSummaryBean bean = EsMarshalling.unmarshallApiSummary(hit.source);
        rval.add(bean);
    }
    return rval;
}
 
开发者ID:apiman,项目名称:apiman,代码行数:22,代码来源:EsStorage.java


示例14: getApiVersions

import io.searchbox.core.SearchResult.Hit; //导入依赖的package包/类
/**
 * @see io.apiman.manager.api.core.IStorageQuery#getApiVersions(java.lang.String, java.lang.String)
 */
@Override
public List<ApiVersionSummaryBean> getApiVersions(String organizationId, String apiId)
        throws StorageException {
    @SuppressWarnings("nls")
    QueryBuilder query = QueryBuilders.filteredQuery(
        QueryBuilders.matchAllQuery(),
        FilterBuilders.andFilter(
                FilterBuilders.termFilter("organizationId", organizationId),
                FilterBuilders.termFilter("apiId", apiId))
    );
    @SuppressWarnings("nls")
    SearchSourceBuilder builder = new SearchSourceBuilder()
            .sort("createdOn", SortOrder.DESC)
            .query(query)
            .size(500);
    List<Hit<Map<String,Object>,Void>> hits = listEntities("apiVersion", builder); //$NON-NLS-1$
    List<ApiVersionSummaryBean> rval = new ArrayList<>(hits.size());
    for (Hit<Map<String,Object>,Void> hit : hits) {
        ApiVersionSummaryBean bean = EsMarshalling.unmarshallApiVersionSummary(hit.source);
        rval.add(bean);
    }
    return rval;
}
 
开发者ID:apiman,项目名称:apiman,代码行数:27,代码来源:EsStorage.java


示例15: getPlansInOrgs

import io.searchbox.core.SearchResult.Hit; //导入依赖的package包/类
/**
 * @see io.apiman.manager.api.core.IStorageQuery#getPlansInOrgs(java.util.Set)
 */
@Override
public List<PlanSummaryBean> getPlansInOrgs(Set<String> organizationIds) throws StorageException {
    @SuppressWarnings("nls")
    SearchSourceBuilder builder = new SearchSourceBuilder()
            .sort("organizationName.raw", SortOrder.ASC)
            .sort("name.raw", SortOrder.ASC)
            .size(500);
    TermsQueryBuilder query = QueryBuilders.termsQuery("organizationId", organizationIds.toArray(new String[organizationIds.size()])); //$NON-NLS-1$
    builder.query(query);
    List<Hit<Map<String,Object>,Void>> hits = listEntities("plan", builder); //$NON-NLS-1$
    List<PlanSummaryBean> rval = new ArrayList<>(hits.size());
    for (Hit<Map<String,Object>,Void> hit : hits) {
        PlanSummaryBean bean = EsMarshalling.unmarshallPlanSummary(hit.source);
        rval.add(bean);
    }
    return rval;
}
 
开发者ID:apiman,项目名称:apiman,代码行数:21,代码来源:EsStorage.java


示例16: getPlanVersions

import io.searchbox.core.SearchResult.Hit; //导入依赖的package包/类
/**
 * @see io.apiman.manager.api.core.IStorageQuery#getPlanVersions(java.lang.String, java.lang.String)
 */
@Override
public List<PlanVersionSummaryBean> getPlanVersions(String organizationId, String planId)
        throws StorageException {
    @SuppressWarnings("nls")
    QueryBuilder query = QueryBuilders.filteredQuery(
        QueryBuilders.matchAllQuery(),
        FilterBuilders.andFilter(
                FilterBuilders.termFilter("organizationId", organizationId),
                FilterBuilders.termFilter("planId", planId))
    );
    @SuppressWarnings("nls")
    SearchSourceBuilder builder = new SearchSourceBuilder()
            .sort("createdOn", SortOrder.DESC)
            .query(query)
            .size(500);
    List<Hit<Map<String,Object>,Void>> hits = listEntities("planVersion", builder); //$NON-NLS-1$
    List<PlanVersionSummaryBean> rval = new ArrayList<>(hits.size());
    for (Hit<Map<String,Object>,Void> hit : hits) {
        PlanVersionSummaryBean bean = EsMarshalling.unmarshallPlanVersionSummary(hit.source);
        rval.add(bean);
    }
    return rval;
}
 
开发者ID:apiman,项目名称:apiman,代码行数:27,代码来源:EsStorage.java


示例17: listPolicyDefinitions

import io.searchbox.core.SearchResult.Hit; //导入依赖的package包/类
/**
 * @see io.apiman.manager.api.core.IStorageQuery#listPolicyDefinitions()
 */
@Override
public List<PolicyDefinitionSummaryBean> listPolicyDefinitions() throws StorageException {
    @SuppressWarnings("nls")
    String[] fields = {"id", "policyImpl", "name", "description", "icon", "pluginId", "formType"};
    @SuppressWarnings("nls")
    QueryBuilder query = QueryBuilders.filteredQuery(
        QueryBuilders.matchAllQuery(),
        FilterBuilders.orFilter(
                FilterBuilders.missingFilter("deleted"),
                FilterBuilders.termFilter("deleted", false))
    );
    SearchSourceBuilder builder = new SearchSourceBuilder()
            .fetchSource(fields, null)
            .query(query)
            .sort("name.raw", SortOrder.ASC).size(100); //$NON-NLS-1$
    List<Hit<Map<String,Object>,Void>> hits = listEntities("policyDef", builder); //$NON-NLS-1$
    List<PolicyDefinitionSummaryBean> rval = new ArrayList<>(hits.size());
    for (Hit<Map<String,Object>,Void> hit : hits) {
        PolicyDefinitionSummaryBean bean = EsMarshalling.unmarshallPolicyDefinitionSummary(hit.source);
        rval.add(bean);
    }
    return rval;
}
 
开发者ID:apiman,项目名称:apiman,代码行数:27,代码来源:EsStorage.java


示例18: getContracts

import io.searchbox.core.SearchResult.Hit; //导入依赖的package包/类
/**
 * @see io.apiman.manager.api.core.IStorageQuery#getContracts(java.lang.String, java.lang.String, java.lang.String, int, int)
 */
@Override
public List<ContractSummaryBean> getContracts(String organizationId, String apiId,
        String version, int page, int pageSize) throws StorageException {
    @SuppressWarnings("nls")
    QueryBuilder query = QueryBuilders.filteredQuery(
        QueryBuilders.matchAllQuery(),
        FilterBuilders.andFilter(
            FilterBuilders.termFilter("apiOrganizationId", organizationId),
            FilterBuilders.termFilter("apiId", apiId),
            FilterBuilders.termFilter("apiVersion", version)
        )
    );
    @SuppressWarnings("nls")
    SearchSourceBuilder builder = new SearchSourceBuilder().sort("clientOrganizationId", SortOrder.ASC)
            .sort("clientId", SortOrder.ASC).query(query).size(500);
    List<Hit<Map<String,Object>,Void>> hits = listEntities("contract", builder); //$NON-NLS-1$
    List<ContractSummaryBean> rval = new ArrayList<>(hits.size());
    for (Hit<Map<String,Object>,Void> hit : hits) {
        ContractSummaryBean bean = EsMarshalling.unmarshallContractSummary(hit.source);
        rval.add(bean);
    }
    return rval;
}
 
开发者ID:apiman,项目名称:apiman,代码行数:27,代码来源:EsStorage.java


示例19: listPluginPolicyDefs

import io.searchbox.core.SearchResult.Hit; //导入依赖的package包/类
/**
 * @see io.apiman.manager.api.core.IStorageQuery#listPluginPolicyDefs(java.lang.Long)
 */
@Override
public List<PolicyDefinitionSummaryBean> listPluginPolicyDefs(Long pluginId) throws StorageException {
    @SuppressWarnings("nls")
    QueryBuilder qb = QueryBuilders.filteredQuery(
            QueryBuilders.matchAllQuery(),
            FilterBuilders.termFilter("pluginId", pluginId)
        );
    @SuppressWarnings("nls")
    String[] fields = {"id", "policyImpl", "name", "description", "icon", "pluginId", "formType"};
    SearchSourceBuilder builder = new SearchSourceBuilder()
            .fetchSource(fields, null)
            .query(qb)
            .sort("name.raw", SortOrder.ASC).size(100); //$NON-NLS-1$
    List<Hit<Map<String,Object>,Void>> hits = listEntities("policyDef", builder); //$NON-NLS-1$
    List<PolicyDefinitionSummaryBean> rval = new ArrayList<>(hits.size());
    for (Hit<Map<String,Object>,Void> hit : hits) {
        PolicyDefinitionSummaryBean bean = EsMarshalling.unmarshallPolicyDefinitionSummary(hit.source);
        rval.add(bean);
    }
    return rval;
}
 
开发者ID:apiman,项目名称:apiman,代码行数:25,代码来源:EsStorage.java


示例20: getUserMemberships

import io.searchbox.core.SearchResult.Hit; //导入依赖的package包/类
/**
 * @see io.apiman.manager.api.core.IStorageQuery#getUserMemberships(java.lang.String)
 */
@Override
public Set<RoleMembershipBean> getUserMemberships(String userId) throws StorageException {
    try {
        @SuppressWarnings("nls")
        QueryBuilder qb = QueryBuilders.filteredQuery(
            QueryBuilders.matchAllQuery(),
            FilterBuilders.termFilter("userId", userId)
        );
        SearchSourceBuilder builder = new SearchSourceBuilder().query(qb).size(500);
        List<Hit<Map<String,Object>,Void>> hits = listEntities("roleMembership", builder); //$NON-NLS-1$
        Set<RoleMembershipBean> rval = new HashSet<>();
        for (Hit<Map<String,Object>,Void> hit : hits) {
            RoleMembershipBean roleMembership = EsMarshalling.unmarshallRoleMembership(hit.source);
            rval.add(roleMembership);
        }
        return rval;
    } catch (Exception e) {
        throw new StorageException(e);
    }
}
 
开发者ID:apiman,项目名称:apiman,代码行数:24,代码来源:EsStorage.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java TemplateType类代码示例发布时间:2022-05-23
下一篇:
Java StringReadChannelListener类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap