home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 423543060

This data as json

html_url issue_url id node_id user created_at updated_at author_association body reactions issue performed_via_github_app
https://github.com/simonw/datasette/issues/292#issuecomment-423543060 https://api.github.com/repos/simonw/datasette/issues/292 423543060 MDEyOklzc3VlQ29tbWVudDQyMzU0MzA2MA== 9599 2018-09-21T14:06:31Z 2018-09-21T14:09:06Z OWNER

I keep on finding new reasons that I want this.

The latest is that I'm playing with the more advanced features of FTS5 - in particular the highlight() function and the ability to sort by rank.

The problem is... in order to do this, I need to properly join against the _fts table. Here's an example query:

select
  highlight(events_fts, 0, '<b>', '</b>'),
  events_fts.rank,
  events.*
from events
  join events_fts on events.rowid = events_fts.rowid
where events_fts match :search 
order by rank

Note that this is a different query from the usual FTS one (which does where rowid in (select rowid from events_fts...)) because I need the rank column somewhere I can sort against.

I'd like to be able to use this on the table view page so I can get faceting etc for free, but this is a completely different query from the default. Maybe I need a way to customize the entire query? That feels weird though - why am I not using a view in that case?

Answer: because views can't accept :search style parameters. I could use a canned query, but canned queries don't get faceting etc.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
326800219  
Powered by Datasette · Queries took 0.884ms · About: github-to-sqlite