我下面講的小面休眠搜索文檔相關對象:我有https://docs.jboss.org/hibernate/stable/search/reference/en-US/html_single/#query-faceting如何獲得冬眠搜索方面
我是能夠產生我的面,例如我authorNames +計數:
name1 = 100
name2 = 200
and so on..
但我的問題是如何查詢作者對象,如果我想顯示它的一些其他細節。
由例如我現在去:
FullTextEntityManager fullTextEntityManager = Search.getFullTextEntityManager(em);
QueryBuilder qb = fullTextEntityManager.getSearchFactory().buildQueryBuilder().forEntity(Book.class).get();
org.apache.lucene.search.Query luceneQuery = qb.all().createQuery();
FullTextQuery fullTextQuery = fullTextEntityManager.createFullTextQuery(luceneQuery, Book.class);
FacetingRequest authorFacet = qb.facet().name("authorFacetRequest").onField("authors.name_facet").discrete()
.orderedBy(FacetSortOrder.FIELD_VALUE).includeZeroCounts(false).createFacetingRequest();
// retrieve facet manager and apply faceting request
FacetManager facetManager = fullTextQuery.getFacetManager();
facetManager.enableFaceting(authorFacet);
// retrieve the faceting results
List<Facet> facets = facetManager.getFacets("authorFacetRequest");
facets.forEach(p -> log.info(p.getValue() + " - " + p.getCount()));
但我想創建一個ID = author.id鏈接的GUI。但是author.id不能使用facet。所以我想要的是:
List<facetName (authorName), count, referenceId>
什麼是最簡單和有效的方式來實現呢?有沒有辦法做到這一點沒有多個查詢?