Details
-
Bug
-
Resolution: Won't Fix
-
Test Blocker
-
sdk-3.1
Description
Currently we have under facet the following example:
https://docs.couchbase.com/java-sdk/current/howtos/full-text-searching-with-sdk.html#facets
Map<String, SearchFacet> facets = new HashMap<>();
|
facets.put("categories", SearchFacet.term("category", 5));
|
|
SearchResult result = cluster.searchQuery(
|
"index",
|
SearchQuery.queryString("query"),
|
searchOptions().facets(facets)
|
);
|
this example is over simplistic and doesn't cover how to retrieve the facet data.
I would recommend to add something like the following that shows the casting:
for (SearchFacetResult sfr : result.facets().values()) {
|
System.out.println("facet_field: " + sfr.field());
|
List<SearchTermRange> tsfRange = ((TermSearchFacetResult) sfr).terms();
|
for (SearchTermRange tsfr: tsfRange) {
|
System.out.println(tsfr.name() +": " + tsfr.count());
|
}
|
}
|
+Add printout
Reporter: Roi Katz
E-mail: roi.katz@Couchbase.com
Attachments
Issue Links
- relates to
-
DOC-8176 JAVA SDK - Full Text Search using the SDK
- Closed