Open mroswell opened 2 years ago
Hmmm... maybe a plugin isn't needed. I need to get to know this issue: https://github.com/simonw/datasette/issues/1552
You need to use a metadata.json and list which fields you want facets for. See https://docs.datasette.io/en/stable/metadata.html and https://docs.datasette.io/en/stable/facets.html#facets-in-metadata-json
You need to use a metadata.json and list which fields you want facets for. See https://docs.datasette.io/en/stable/metadata.html and https://docs.datasette.io/en/stable/facets.html#facets-in-metadata-json
This does not yield the desired behavior.
I added a metadata.json file, so if you can fire up Datasette you'll see this behavior. I'm pretty sure a plugin is needed.
You can put all the fields that you want to be suggested and then turn off facets using config.
datasette articles.db --metadata metadata.json --config suggest_facets:off
With suggest_facets:off, we get:
---- AFTER:
---- BEFORE:
So, despite implementing all of the above, still not getting the behavior I'm seeking. I want to give the user access to selected facets.
(Note that with the solution above, there is no ability to turn off the long list of Main_Topics, or any other facets I decide to add)
See the pull-request for a fix for this.
By default, Datasette is offering these suggested facets in the following order.
Main_Topic, Title, Link(s), Demographics, Abstract, MeSH, Author(s), Affiliation, PMID, PMCID, PubDate, article_title, Section, Subsection, PubType, PubDate (date), Main_Topic (array), Demographics (array), MeSH (array), Author(s) (array), Affiliation (array)
Replace this with Main_Topic, Demographics, MeSH, Author(s), Section, Subsection, PubType
there may be some model code (though by a relative newbie coder) here: https://github.com/mroswell/list-N/tree/main/plugins or https://datasette.io/plugins