Saturday, May 13, 2023

LiQuery.js: SQLite + search

 haxtra/liquery: Powerful search, tagging, filtering and sorting via simple text query language, for SQLite databases @GitHub

Powerful search, tagging, filtering and sorting via simple text query language, for SQLite databases.

10kb maximized, no dependencies.

generates SQL from compact query strings

Example
hq hammond rock|metal !jazz type:mp3 year:1970-1980 rating:desc

Translates to:

SELECT * FROM music
WHERE search LIKE '%hammond%'
AND (search LIKE '%rock%' OR search LIKE '%metal%')
AND search NOT LIKE '%jazz%'
AND type='mp3'
AND year BETWEEN 1970 AND 1980
AND bitrate=320    -- preset from `hq` keyword
AND sampling=44.1  -- preset from `hq` keyword
ORDER BY rating DESC
LIMIT 100 OFFSET 0

No comments: