本文整理汇总了Java中org.elasticsearch.search.facet.Facets类的典型用法代码示例。如果您正苦于以下问题:Java Facets类的具体用法?Java Facets怎么用?Java Facets使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Facets类属于org.elasticsearch.search.facet包,在下文中一共展示了Facets类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getFacets
import org.elasticsearch.search.facet.Facets; //导入依赖的package包/类
public Facets getFacets() {
return facets;
}
开发者ID:dainst,项目名称:gazetteer,代码行数:4,代码来源:ElasticSearchPlaceQuery.java
示例2: testTopicFacets
import org.elasticsearch.search.facet.Facets; //导入依赖的package包/类
@Test
public void testTopicFacets() throws Exception {
DateTime now = new DateTime(DateTimeZones.UTC);
Broadcast broadcast1 = new Broadcast(Id.valueOf(1), now, now.plusHours(1));
Broadcast broadcast2 = new Broadcast(Id.valueOf(1), now.plusHours(2), now.plusHours(3));
Tag topic1 = new Tag(Id.valueOf(1), 1.0f, Boolean.TRUE, Tag.Relationship.ABOUT);
Tag topic2 = new Tag(Id.valueOf(2), 1.0f, Boolean.TRUE, Tag.Relationship.ABOUT);
Item item1 = new Item("uri1", "curie1", Publisher.METABROADCAST);
item1.addBroadcast(broadcast1);
item1.setId(Id.valueOf(1));
item1.addTopicRef(topic1);
item1.addTopicRef(topic2);
Item item2 = new Item("uri2", "curie2", Publisher.METABROADCAST);
item2.addBroadcast(broadcast1);
item2.setId(Id.valueOf(2));
item2.addTopicRef(topic1);
Item item3 = new Item("uri3", "curie3", Publisher.METABROADCAST);
item3.addBroadcast(broadcast2);
item3.setId(Id.valueOf(3));
item3.addTopicRef(topic2);
contentIndexer.index(item1);
contentIndexer.index(item2);
contentIndexer.index(item3);
refresh(esClient.client());
ListenableActionFuture<SearchResponse> futureResult = esClient.client()
.prepareSearch(EsSchema.CONTENT_INDEX)
.setQuery(QueryBuilders.nestedQuery(
EsContent.BROADCASTS,
QueryBuilders.rangeQuery(EsBroadcast.TRANSMISSION_TIME)
.from(now.minusHours(1).toDate())
.to(now.plusHours(1).toDate())
))
.addFacet(FacetBuilders.termsFacet("topicFacet")
.nested(EsContent.TOPICS + "." + EsTopicMapping.TOPIC)
.field(EsContent.TOPICS + "." + EsTopicMapping.TOPIC_ID))
.execute();
SearchResponse result = futureResult.actionGet(5, TimeUnit.SECONDS);
Facets facets = result.getFacets();
List<? extends Entry> terms = facets.facet(TermsFacet.class, "topicFacet").getEntries();
assertEquals(2, terms.size());
assertEquals("1", terms.get(0).getTerm().string());
assertEquals(2, terms.get(0).getCount());
assertEquals("2", terms.get(1).getTerm().string());
assertEquals(1, terms.get(1).getCount());
}
开发者ID:atlasapi,项目名称:atlas-deer,代码行数:54,代码来源:EsUnequivalentContentIndexingTest.java
示例3: setFacets
import org.elasticsearch.search.facet.Facets; //导入依赖的package包/类
public void setFacets(Facets facets) {
this.facets = facets;
}
开发者ID:yamingd,项目名称:argo,代码行数:4,代码来源:SearchResult.java
注:本文中的org.elasticsearch.search.facet.Facets类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论