Table Faceted Navigation
Mockups
Clicking on facets will additonal filters to the user's queries but will not actually modify the user's written query because it would be very difficult to differentiate the user's WHERE clause vs WHERE appended by the facet.
The range facets can be displayed by either a slider or boxes for input of min and max values. Preferably, this should also mention to the user that the ranges are inclusive.
Model
Table Schema
The ColumnModel class will have a new FacetType field with enum values of {range, enumeration}. A column that is not faceted will have a faceType value of null.
Requests
Client would submit the facet data using the already existing API: POST /entity/{id}/table/query/async/start
The Query class will have an additional List<FacetColumnRequest> field.
The QueryBundleRequest class will be unchanged. It is listed simply because the clients would be submitting an instance of this class to the Synapse repository. We use the 5th bit (0x20 mask) in partMask in QueryBundleRequest to determine whether or not to return facet information.
FacetColumnRequest will be an interface that contains the name of the column that will be filtered.
FacetColumnValuesRequest implements FacetColumnRequest and has an additional facetValues field which describes the set of values that the results of that columnName must equal.
FacetColumnRangeRequest implements FacetColumnRequest and has min and max fields to describe the inclusive range of the results of that columnName. If any of min, max, or both are null, then that side of the range is unbounded.
The FacetColumnRequest implementation sent will be dependent on the facetType of each column
Download CSV Request
In addition to table query request, the DownloadFromTableRequest object will also need to handle facets.
Results
The facet results will be returned along with the rest of the query results in a QueryResultBundle when GET /entity/{id}/table/query/async/get/{asyncToken} is called.
QueryFacetResultBundle will have an additional List<FacetColumnResult> field.
FacetColumnResult will be an interface for resulting facet information and contains fields columnName and facetType.
Depending on the FacetType, the implementation will either be FacetColumnResultValues or FacetColumnResultRange
FacetColumnResultValues will contain a list of FacetColumnResultValueCounts, which have the counts of each specific value in the column, and whether that value was previously selected by the user in the request.
FacetColumnResultRange will contain the user's selected min and max range, and also the min and max values of the column.
Facet API
Will append to preexisting API's
Action | Intended User | URI | Method | Request Body | Response Body |
---|---|---|---|---|---|
Start an asynchronous job to query a table | User with read on a table | /entity/{id}/table/query/async/start | POST | QueryBundleRequest | |
Get the asynchronous job results containing the TableFacet data | User that started the job | /entity/{id}/table/query/async/get/{asyncToken} | GET | QueryResultBundle |