sakaiproject/Hilary — pull request #489 by mrvisser (2013-05-08 14:48:29+00:00)
Title: (Facets) Facet searches on resource type

There is now a `facets` object on the search results. Example result:

```json
{
"total": 1,
"results": [
{
"resourceType": "user",
"id": "u:cam:VVR0wpRSxM",
"tenantAlias": "cam",
"displayName": "Branden Visser",
"visibility": "public",
"profilePath": "/user/u:cam:VVR0wpRSxM",
"thumbnailUrl": "/api/download/signed?uri=remote:https://si0.twimg.com/profile_images/987425409/me1_normal.jpg&signature=eec7c2d39276c133a19d59b5cfc7e75a7c20631c&expires=1368090000000",
"tenant": {
"alias": "cam",
"displayName": "Cambridge"
}
}
],
"facets": {
"resourceTypes": {
"total": 1,
"items": [
{
"term": "user",
"count": 1
}
]
}
}
}
```

`resourceTypes` is a "name" of many different types of facets we can have (resourceTypes is a "term" facet that facets on the "resourceType" field).

`total` is the total number of unique facets that were matched (it is possible to page the facets themselves, I believe)

`items` is a list of the facets in the current facet-page

Then each item has a "term", for the value that matched the facet term, and a "count", which is how many total items in the search index would match the query with that facet value.