chore: search cleanup
This commit is contained in:
parent
6833d054cc
commit
01ed2ac3b3
4 changed files with 9 additions and 31 deletions
4
package-lock.json
generated
4
package-lock.json
generated
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "coryd.dev",
|
||||
"version": "1.5.9",
|
||||
"version": "1.5.10",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "coryd.dev",
|
||||
"version": "1.5.9",
|
||||
"version": "1.5.10",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@cdransf/api-text": "^1.5.0",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "coryd.dev",
|
||||
"version": "1.5.9",
|
||||
"version": "1.5.10",
|
||||
"description": "The source for my personal site. Built using 11ty (and other tools).",
|
||||
"type": "module",
|
||||
"engines": {
|
||||
|
|
|
@ -107,8 +107,9 @@ window.addEventListener("load", () => {
|
|||
"total_plays",
|
||||
],
|
||||
searchOptions: {
|
||||
fields: ["title", "tags"],
|
||||
prefix: true,
|
||||
fuzzy: 0.2,
|
||||
fuzzy: 0,
|
||||
boost: { title: 2, tags: 1.5 },
|
||||
sort: (a, b) => b.score - a.score,
|
||||
},
|
||||
|
|
|
@ -46,24 +46,6 @@ WITH search_data AS (
|
|||
|
||||
UNION ALL
|
||||
|
||||
SELECT
|
||||
'movie' AS type,
|
||||
CASE
|
||||
WHEN m.rating IS NOT NULL THEN CONCAT('🎥 ', m.title, ' (', m.rating, ')')
|
||||
ELSE CONCAT('🎥 ', m.title)
|
||||
END AS title,
|
||||
CONCAT('https://coryd.dev', m.url) AS url,
|
||||
m.description AS description,
|
||||
m.tags,
|
||||
NULL AS genre_name,
|
||||
NULL AS genre_url,
|
||||
NULL::integer AS total_plays,
|
||||
m.last_watched AS content_date
|
||||
FROM optimized_movies m
|
||||
WHERE m.last_watched IS NOT NULL
|
||||
|
||||
UNION ALL
|
||||
|
||||
SELECT
|
||||
'artist' AS type,
|
||||
CONCAT(COALESCE(ar.emoji, ar.genre_emoji, '🎧'), ' ', ar.name) AS title,
|
||||
|
@ -107,14 +89,9 @@ WITH search_data AS (
|
|||
s.last_watched_at AS content_date
|
||||
FROM optimized_shows s
|
||||
WHERE s.last_watched_at IS NOT NULL
|
||||
),
|
||||
search_data_with_id AS (
|
||||
SELECT
|
||||
ROW_NUMBER() OVER (ORDER BY content_date DESC NULLS LAST, url) AS id,
|
||||
search_data.*
|
||||
FROM search_data
|
||||
)
|
||||
|
||||
SELECT
|
||||
id, url, title, description, tags, genre_name, genre_url, type, total_plays
|
||||
FROM search_data_with_id
|
||||
ORDER BY content_date DESC NULLS LAST, url;
|
||||
ROW_NUMBER() OVER (ORDER BY url) AS id,
|
||||
*
|
||||
FROM search_data;
|
Reference in a new issue