I added search functionality to Opus Classical. It was quite simple, but I learnt a few things.
Adding CORS to Saturn is pretty straightforward
let configureCors (builder: CorsPolicyBuilder) =
builder
.AllowAnyOrigin()
.AllowAnyMethod()
.AllowAnyHeader()
|> ignore
let app =
application {
// ...
use_cors "All" configureCors
// ...
}
Svelte is fantastic for this kind of thing
Choose a node, attach a Svelte component to it. Have reactivity, nice clean syntax and TypeScript.
5kb of compressed JS bundle is pretty comparable to what I would have had with Vanilla JS and hardly possible with Vue/React/Angular.
Postgres trigram is godly
Do an index:
CREATE INDEX idx
ON composers USING gin(last_name gin_trgm_ops);
Make super fast fuzzy search selects:
select id, last_name, similarity(last_name, 'beth') as score
from composers
where last_name % 'beth'
order by score desc
limit 5
Top comments (0)