Details
-
Bug
-
Status: Open
-
Test Blocker
-
Resolution: Unresolved
-
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
-
- Open
-
Gerrit Reviews
Activity
Field | Original Value | New Value |
---|---|---|
Description |
Currently we have under facet the following example:
https://docs.couchbase.com/java-sdk/current/howtos/full-text-searching-with-sdk.html#facets {code} Map<String, SearchFacet> facets = new HashMap<>(); facets.put("categories", SearchFacet.term("category", 5)); SearchResult result = cluster.searchQuery( "index", SearchQuery.queryString("query"), searchOptions().facets(facets) ); {code} 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: {code} for (SearchFacetResult sfr : result.facets().values()) { System.out.println("facet_field: " + sfr.field()); System.out.println(((TermSearchFacetResult) sfr).terms()); } } {code} *Reporter*: Roi Katz *E-mail*: [mailto:roi.katz@Couchbase.com] |
Currently we have under facet the following example:
https://docs.couchbase.com/java-sdk/current/howtos/full-text-searching-with-sdk.html#facets {code} Map<String, SearchFacet> facets = new HashMap<>(); facets.put("categories", SearchFacet.term("category", 5)); SearchResult result = cluster.searchQuery( "index", SearchQuery.queryString("query"), searchOptions().facets(facets) ); {code} 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: {code} 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()); } } {code} *Reporter*: Roi Katz *E-mail*: [mailto:roi.katz@Couchbase.com] |
Description |
Currently we have under facet the following example:
https://docs.couchbase.com/java-sdk/current/howtos/full-text-searching-with-sdk.html#facets {code} Map<String, SearchFacet> facets = new HashMap<>(); facets.put("categories", SearchFacet.term("category", 5)); SearchResult result = cluster.searchQuery( "index", SearchQuery.queryString("query"), searchOptions().facets(facets) ); {code} 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: {code} 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()); } } {code} *Reporter*: Roi Katz *E-mail*: [mailto:roi.katz@Couchbase.com] |
Currently we have under facet the following example:
https://docs.couchbase.com/java-sdk/current/howtos/full-text-searching-with-sdk.html#facets {code} Map<String, SearchFacet> facets = new HashMap<>(); facets.put("categories", SearchFacet.term("category", 5)); SearchResult result = cluster.searchQuery( "index", SearchQuery.queryString("query"), searchOptions().facets(facets) ); {code} 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: {code} 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()); } } {code} +Add printout *Reporter*: Roi Katz *E-mail*: [mailto:roi.katz@Couchbase.com] |
Priority | Test Blocker [ 6 ] |
Component/s | server dev guide and SDKs [ 11814 ] | |
Epic Link | DOC-8196 [ 152156 ] | |
Fix Version/s | sdk3.1-backlog [ 17244 ] | |
Fix Version/s | sdk3.2-backlog [ 17245 ] | |
Story Points | 1 | |
Affects Version/s | SDK-3.1 [ 17058 ] | |
Assignee | Amarantha Kulkarni [ amarantha.kulkarni ] | Richard Smedley [ richard smedley ] |
Labels | collector-709818cb | collector-709818cb fts search |
Labels | collector-709818cb fts search | SDKDOC-improvement collector-709818cb fts search |
Assignee | Richard Smedley [ richard smedley ] | Hakim Cassimally [ JIRAUSER25269 ] |