mirror of
https://github.com/simonw/datasette.git
synced 2026-06-05 08:37:00 +02:00
Add per-table suggest_facets configuration option
Allow disabling suggested facets for individual tables by setting "suggest_facets": false in table configuration. This is useful for tables where facet suggestions are unhelpful or too expensive, while keeping them enabled for other tables in the same instance. https://claude.ai/code/session_01JkWNePDCxMYKcq5qSfMo3r
This commit is contained in:
parent
1c6c6d2e68
commit
1a53bdc793
4 changed files with 86 additions and 1 deletions
|
|
@ -254,6 +254,55 @@ For the currently filtered data are there any columns which, if applied as a fac
|
|||
That last point is particularly important: Datasette runs a query for every column that is displayed on a page, which could get expensive - so to avoid slow load times it sets a time limit of just 50ms for each of those queries.
|
||||
This means suggested facets are unlikely to appear for tables with millions of records in them.
|
||||
|
||||
You can turn off suggested facets for a specific table by setting ``"suggest_facets"`` to ``false`` in the table's configuration:
|
||||
|
||||
.. [[[cog
|
||||
from metadata_doc import metadata_example
|
||||
metadata_example(cog, {
|
||||
"databases": {
|
||||
"mydb": {
|
||||
"tables": {
|
||||
"big_table": {
|
||||
"suggest_facets": False
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
.. ]]]
|
||||
|
||||
.. tab:: metadata.yaml
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
databases:
|
||||
mydb:
|
||||
tables:
|
||||
big_table:
|
||||
suggest_facets: false
|
||||
|
||||
|
||||
.. tab:: metadata.json
|
||||
|
||||
.. code-block:: json
|
||||
|
||||
{
|
||||
"databases": {
|
||||
"mydb": {
|
||||
"tables": {
|
||||
"big_table": {
|
||||
"suggest_facets": false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.. [[[end]]]
|
||||
|
||||
This will disable suggested facets for that table only. Other tables in the same database will continue to suggest facets as normal. Explicitly requested facets (using ``?_facet=column``) will still work.
|
||||
|
||||
You can also disable suggested facets for the entire Datasette instance using the :ref:`setting_suggest_facets` setting.
|
||||
|
||||
Speeding up facets with indexes
|
||||
-------------------------------
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue