home / github / issues

Menu
  • Search all tables
  • GraphQL API

issues: 431800286

This data as json

id node_id number title user state locked assignee milestone comments created_at updated_at closed_at author_association pull_request body repo type active_lock_reason performed_via_github_app reactions draft state_reason
431800286 MDU6SXNzdWU0MzE4MDAyODY= 427 New design for facet abstraction, including querystring and metadata.json 9599 closed 0     10 2019-04-11T02:24:15Z 2019-05-29T21:39:12Z 2019-05-03T00:11:29Z OWNER  

I need a better design for query strings for facets (and for how facets are enabled in metadata.json).

Think of all of the potential kinds of facets:

  • ?_facet_array=tags where tags is a JSON array of values
  • _facet_date=datetimecol - faceted by date part of a datetime
  • _facet_bins=numeric_column - can I do some kind of fancy binning here? Might need to take an argument
  • ?_facet_bins=numeric_column:5 - could be a way to take an argument. We’ll ignore columns with a : in their name.
  • ?_facet_json=jsoncol:jsonpath - could use a JSON path to extract out something to facet on?
  • ?_facet_percentile=numericcolumn - could this work?
  • ?_facet_function=column:sqlfunctionname - maybe this could be interesting? Would allow for e.g. facet by soundex
  • ?_facet_prefix=column:prefix - facet by terms but only if they start with a specific prefix
  • ?_facet_substring=column:3,6 - facet by a substr(column, 3, 6)

Maybe bundling JSON in querystrings is a way to do options?

?_facet_distance={"latitude_column":"x",...}

Could detect values starting with { - and if for some weird reason you have a column starting with that character you can pass this instead: ?_facet_percentile={"column": "{value}"}

This could even be the mechanism that allows us to extend regular facets to support additional options like adding a sum or max to each one.

Problem: it’s not obvious what the name associated with these facets should be. What if one column is faceted multiple times using multiple facet variants?

Maybe just number them? name1=… name2=… etc?

Other option is to use Solr style querystring syntax for notation. Solr does this: ?f.price.facet.range.gap=100&f.age.facet.range.gap=10

So how about this:

?_facet_range=age&_facet_range.span=5

Related: #359

107914493 issue    
{
    "url": "https://api.github.com/repos/simonw/datasette/issues/427/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed

Links from other tables

  • 1 row from issues_id in issues_labels
  • 10 rows from issue in issue_comments
Powered by Datasette · Queries took 1.355ms · About: github-to-sqlite