Skip to content

Support for ?_search_colname=blah searches #237

@simonw

Description

@simonw

Right now the _search= argument searches across all fields in a full-text index, for example:

https://san-francisco.datasettes.com/sf-film-locations-84594a7/Film_Locations_in_San_Francisco?_search=justin

SQLite FTS also supports searches within a specified field, for example:

https://san-francisco.datasettes.com/sf-film-locations-84594a7?sql=select+rowid%2C+*+from+Film_Locations_in_San_Francisco+where+rowid+in+%28select+rowid+from+%5BFilm_Locations_in_San_Francisco_fts%5D+where+%5BLocations%5D+match+%3Asearch%29+order+by+rowid+limit+101&search=justin

select rowid, * from Film_Locations_in_San_Francisco
where rowid in (
  select rowid from [Film_Locations_in_San_Francisco_fts]
  where [Locations] match :search
) order by rowid limit 101

The _search= parameter could be extended to support this using _search_colname=.

This should also be able to support columns with spaces and special characters in their names, something like this:

_search_Column%20With%20Spaces=foo

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions