Skip to content

Extract facet code out into a new plugin hook, closes #427#445

Merged
simonw merged 16 commits intomasterfrom
facet-refactor-2
May 3, 2019
Merged

Extract facet code out into a new plugin hook, closes #427#445
simonw merged 16 commits intomasterfrom
facet-refactor-2

Conversation

@simonw
Copy link
Owner

@simonw simonw commented May 3, 2019

Datasette previously only supported one type of faceting: exact column value counting.

With this change, faceting logic is extracted out into one or more separate classes which can implement other patterns of faceting - this is discussed in #427, but potential upcoming facet types include facet-by-date, facet-by-JSON-array, facet-by-many-2-many and more.

A new plugin hook, register_facet_classes, can be used by plugins to add in additional facet classes.

Each class must implement two methods: suggest(), which scans columns in the table to decide if they might be worth suggesting for faceting, and facet_results(), which executes the facet operation and returns results ready to be displayed in the UI.

@simonw simonw merged commit ea66c45 into master May 3, 2019
@simonw simonw deleted the facet-refactor-2 branch May 3, 2019 18:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant