{"html_url": "https://github.com/simonw/sqlite-utils/issues/198#issuecomment-723145383", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/198", "id": 723145383, "node_id": "MDEyOklzc3VlQ29tbWVudDcyMzE0NTM4Mw==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-11-06T15:36:47Z", "updated_at": "2020-11-06T15:36:47Z", "author_association": "OWNER", "body": "Should I register the custom `rank_bm25` SQLite function for every connection, or should I register it against the connection just the first time the user attempts an FTS4 search? I think I'd rather register it only if it is needed.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 737476423, "label": "Support order by relevance against FTS4"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/sqlite-utils/issues/198#issuecomment-723144893", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/198", "id": 723144893, "node_id": "MDEyOklzc3VlQ29tbWVudDcyMzE0NDg5Mw==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-11-06T15:35:45Z", "updated_at": "2020-11-06T15:35:45Z", "author_association": "OWNER", "body": "Here's a demo of that rank query. I had to sort by `rank` instead of `rank desc` - need to double-check that:\r\n\r\nhttps://datasette-sqlite-fts4.datasette.io/24ways-fts4?sql=with+original+as+(%0D%0A++++select%0D%0A++++++++rowid%2C%0D%0A++++++++*%0D%0A++++from+[articles]%0D%0A)%0D%0Aselect%0D%0A++++original.*%2C%0D%0A++++rank_bm25(matchinfo([articles_fts]%2C+%27pcnalx%27))+as+rank%0D%0Afrom%0D%0A++++[original]%0D%0A++++join+[articles_fts]+on+[original].rowid+%3D+[articles_fts].rowid%0D%0Awhere%0D%0A++++[articles_fts]+match+%3Aquery%0D%0Aorder+by%0D%0A++++rank%0D%0Alimit+20&query=jquery+maps", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 737476423, "label": "Support order by relevance against FTS4"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/sqlite-utils/issues/198#issuecomment-723143633", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/198", "id": 723143633, "node_id": "MDEyOklzc3VlQ29tbWVudDcyMzE0MzYzMw==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-11-06T15:33:12Z", "updated_at": "2020-11-06T15:33:12Z", "author_association": "OWNER", "body": "Here's the FTS5 query:\r\n```sql\r\nwith original as (\r\n select\r\n rowid,\r\n *\r\n from [global-power-plants]\r\n)\r\nselect\r\n original.*,\r\n [global-power-plants_fts].rank as rank\r\nfrom\r\n [original]\r\n join [global-power-plants_fts] on [original].rowid = [global-power-plants_fts].rowid\r\nwhere\r\n [global-power-plants_fts] match :query\r\norder by\r\n rank desc\r\nlimit 20\r\n```\r\nThe equivalent using `rank_bm25()` for FTS4 would be:\r\n```sql\r\nwith original as (\r\n select\r\n rowid,\r\n *\r\n from [global-power-plants]\r\n)\r\nselect\r\n original.*,\r\n rank_bm25(matchinfo([global-power-plants_fts], 'pcnalx')) as rank\r\nfrom\r\n [original]\r\n join [global-power-plants_fts] on [original].rowid = [global-power-plants_fts].rowid\r\nwhere\r\n [global-power-plants_fts] match :query\r\norder by\r\n rank desc\r\nlimit 20\r\n```", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 737476423, "label": "Support order by relevance against FTS4"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/sqlite-utils/issues/198#issuecomment-722895825", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/198", "id": 722895825, "node_id": "MDEyOklzc3VlQ29tbWVudDcyMjg5NTgyNQ==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-11-06T06:29:17Z", "updated_at": "2020-11-06T06:29:17Z", "author_association": "OWNER", "body": "I released a 1.0 (and 1.0.1) version of https://github.com/simonw/sqlite-fts4", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 737476423, "label": "Support order by relevance against FTS4"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/sqlite-utils/issues/198#issuecomment-722852262", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/198", "id": 722852262, "node_id": "MDEyOklzc3VlQ29tbWVudDcyMjg1MjI2Mg==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-11-06T05:41:58Z", "updated_at": "2020-11-06T05:41:58Z", "author_association": "OWNER", "body": "Example query (from the tests):\r\n```sql\r\nselect c0, c1, rank_bm25(matchinfo(search, 'pcnalx')) as bm25\r\n from search where search match ?\r\n```", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 737476423, "label": "Support order by relevance against FTS4"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/sqlite-utils/issues/198#issuecomment-722849539", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/198", "id": 722849539, "node_id": "MDEyOklzc3VlQ29tbWVudDcyMjg0OTUzOQ==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-11-06T05:39:17Z", "updated_at": "2020-11-06T05:39:17Z", "author_association": "OWNER", "body": "I'd have to copy almost all of the code in https://github.com/simonw/sqlite-fts4/blob/master/sqlite_fts4/__init__.py so I think I will add it as a dependency instead.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 737476423, "label": "Support order by relevance against FTS4"}, "performed_via_github_app": null}