Excerpt |
---|
This section shows how the different data types of facets affect their usage in queries and dashboards. Facets are typically set up within a project using a facets.json file used by the data loader. |
Table of Contents
Table of Contents | ||||
---|---|---|---|---|
|
Overview
Once data is added to a project, facets can be found on the left side of the search screen. Hovering over one of the facets will show the different values for that facet, and the number of items which have each value. Selecting one of the facet values shown performs a drilldown to only show the items which include that specific facet value.
Facets can also be visualized by a dashboard widget.
Searching facet Values
General Information on basic search syntax, as well as the different types of searches supported by squirro can be found in the Query Syntax page.
String Facets
Searchable String Facets
String facets which have the Searchable property set to True will have all of the values stored within that facet available for full text search.
For example, if a document contains the value "United States of America" within a searchable string facet, the document will be returned by a search for the term "America", or a search for "States".
In addition to full text search, the values in searchable string facets are also available for exact value searches (see below).
Non-Searchable String Facets
While values in non-searchable string facets are not available for full text search, searches for exact facet values can be run against values in non-searchable string facets.
Searching for an exact facet value is done by specifying the name of the facet, then a colon, then the exact name of the facet value to search for, with no spaces between. If the value to search for includes spaces, the value must be enclosed in quotes.
Code Block |
---|
Company:Enron
Person:"John Smith"
"First Name":John |
In this example, documents which include other variations of Enron, such as "Enron, Inc.", "Enron Corp", or any other variation will not be returned as results.
Another consequence of not being searchable is that non-searchable string facets cannot be used for sorting alphabetically based on facet values.
Datetime Facets
Similarly to string facets, you can search for a document which has a specific value within a datetime facet.
Note | ||
---|---|---|
| ||
When using a date string in a search, the date string must be quoted 2016-04-04T00:00:00 --> "2016-04-04T00:00:00" |
Code Block |
---|
date_facet:"2016-04-04T00:00:00" |
Searches for ranges of values within datetime facets can also be done by using the ">" or "<" operators.
Code Block |
---|
date_facet >= "2016-02-01T00:00:00" |
Numeric Facets
Exact numeric values can be searched for with the usual colon syntax:
Code Block |
---|
int_facet:3
float_facet:12.73 |
Just like datetime facets, searches for ranges of values within numeric facets can also be done by using the ">" or "<" operators.
Code Block |
---|
int_facet > 2
float_facet <= 20 |
Using facets in Dashboards
Facets are the source for rich dashboard charts and filters. Each facet type opens up different capabilities in the dashboards.
String Facets
When using a string facet in a dashboard, the selected visualization will most often be used to show how many documents include each possible value of that facet.
Datetime Facets
For widgets that show changes in information over time, such as line charts, datetime facets can be used in place of the creation date for the document to determine the X-axis position of a result on the line chart.
Numeric Facets
Numeric facets can be used in dashboard widgets to either visualize the data in the numeric facet directly, or visualize an aggregation of the numeric data based on common values within another facet.
Visualizing Facet Values Directly
When numeric facet values are visualized directly, the visualization behaves similarly to a string facet, and the different values within the numeric facet are shown by the widget. In many cases, a better option is to use a pipelet which breaks the numeric facet data out into ranges (<1, 1-10, 10-50, 50+, etc.). These ranges can be stored in a separate string facet, then visualized more effectively.
...
...
Aggregating Facet Values
When numeric facet values are aggregated, the widget shows an aggregation (sum, average, ...) of the values in the numeric facet, across all of the documents which have a common value in another facet.
The second facet used for aggregation is most often a string facet.
Both the Table widget and Line chart widget support aggregations of numeric facets based on second facets.
The example below is a table widget which shows an aggregation of a float facet (the $ amount of each investment), aggregated by a string facet (the investment type).
...
...
Sorting
Within a table widget in a dashboard, documents can be sorted based on the values that they contain in one or more facets.
To enable sorting within a given facet, click on the table header row for that facet. A colored number will appear indicating that the facet is being used for sorting.
This page can now be found at Labels on the Squirro Docs site.