sections: facets:facets-metadata
This data as json
| id | page | ref | title | content | breadcrumbs | references |
|---|---|---|---|---|---|---|
| facets:facets-metadata | facets | facets-metadata | Facets in configuration | You can turn facets on by default for specific tables by adding a "facets" key to the table configuration in datasette.yaml . See also the table configuration reference for a quick overview. Here's an example that turns on faceting by default for the qLegalStatus column in the Street_Tree_List table in the sf-trees database: [[[cog from metadata_doc import config_example config_example(cog, { "databases": { "sf-trees": { "tables": { "Street_Tree_List": { "facets": ["qLegalStatus"] } } } } }) ]]] [[[end]]] Facets defined in this way will always be shown in the interface and returned in the API, regardless of the _facet arguments passed to the view. Facets defined in configuration will be displayed in the order they are listed. Any additional facets added via query string parameters (e.g. ?_facet=column_name ) will appear after the configured facets, sorted by the number of unique values. You can specify array or date facets using JSON objects with a single key of array or date and a value specifying the column, like this: [[[cog config_example(cog, { "facets": [ {"array": "tags"}, {"date": "created"} ] }) ]]] [[[end]]] You can change the default facet size (the number of results shown for each facet) for a table using facet_size : [[[cog config_example(cog, { "databases": { "sf-trees": { "tables": { "Street_Tree_List": { "facets": ["qLegalStatus"], "facet_size": 10 } } } } }) ]]] [[[end]]] | ["Facets"] | [] |