Changeset 834bcc3 in Klonkt for src/routes/search.js
- Timestamp:
- 06/23/2026 06:14:27 PM (3 months ago)
- Branches:
- main
- Children:
- d774679
- Parents:
- bb42dfb
- File:
-
- 1 edited
-
src/routes/search.js (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/routes/search.js
rbb42dfb r834bcc3 1 1 /** 2 * GET /search?q=... -> volledige resultatenpagina3 * GET /search/suggest?q=... -> compact e JSON voor live resultaten in de overlay2 * GET /search?q=... -> full results page 3 * GET /search/suggest?q=... -> compact JSON for live results in the overlay 4 4 * 5 * Doorzoekt de huidige site op:5 * Searches the current site across: 6 6 * 1. Posts via posts_fts (FTS5, prefix-matching) — published only. 7 * 2. Nummers (audio_tracks) op titel / artiest / album.8 * 3. Even ementen (shows) op plaats / locatie / land / notitie — als de agenda aan staat.9 * 4. Pag ina's (Agenda / Downloads / Links / Perskit / Archief) op naam — alleen10 * de beschikbare.7 * 2. Tracks (audio_tracks) on title / artist / album. 8 * 3. Events (shows) on city / venue / country / notes — when the agenda is enabled. 9 * 4. Pages (Agenda / Downloads / Links / Press kit / Archive) by name — only 10 * the available ones. 11 11 * 12 * FTS5: user -input wordt getokeniseerd op niet-letter/cijfer en elk token tussen13 * dubbele quotes + `*` gezet → prefix-match, geenoperator-soup/syntax-errors.12 * FTS5: user input is tokenised on non-letter/digit chars and each token is wrapped 13 * in double quotes + `*` → prefix-match, no operator-soup/syntax-errors. 14 14 */ 15 15 … … 47 47 } 48 48 49 // ── De kern: alle bronnen doorzoeken voor één site. `lim` begrenst per groep50 // ( klein voor de live-suggesties, ruim voor de volle pagina).──────────────49 // ── Core: search all sources for one site. `lim` caps results per group 50 // (small for live suggestions, large for the full page). ────────────────── 51 51 function searchSite(req, res, rawQ, lim) { 52 52 const site = res.locals.site; … … 79 79 } 80 80 81 // 2. Nummers81 // 2. Tracks 82 82 try { 83 83 const trackRows = db.prepare(` … … 108 108 } catch (err) { if (!out.queryError) out.queryError = err.message; } 109 109 110 // 3. Even ementen (agenda) — alleen als de agenda publiek aan staat.110 // 3. Events (agenda) — only when the agenda is publicly enabled. 111 111 if (premiumUnlocked() && getSetting('agenda_enabled') === '1') { 112 112 try { … … 125 125 } 126 126 127 // 4. Pag ina's — curated, alleen de beschikbare; match op de (vertaalde) naam.127 // 4. Pages — curated, available ones only; matched against the (translated) name. 128 128 const ql = rawQ.toLowerCase(); 129 129 const candidates = [ … … 143 143 } 144 144 145 // ── Volledige resultatenpagina───────────────────────────────────────────────145 // ── Full results page ──────────────────────────────────────────────────────── 146 146 router.get('/', (req, res) => { 147 147 const site = res.locals.site; … … 165 165 }); 166 166 167 // ── Live suggesti es (JSON) ───────────────────────────────────────────────────167 // ── Live suggestions (JSON) ────────────────────────────────────────────────── 168 168 router.get('/suggest', (req, res) => { 169 169 const site = res.locals.site;
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)