Use full text search instead of ilike for search functionality

This commit is contained in:
thiloho
2024-08-14 21:37:19 +02:00
parent 0e3fb96dda
commit 3eb05da564
5 changed files with 90 additions and 4 deletions

View File

@@ -10,7 +10,7 @@ export const load: PageServerLoad = async ({ fetch, cookies, url }) => {
const baseFetchUrl = `${API_BASE_PREFIX}/website`;
if (searchQuery) {
params.append("title", `ilike.*${searchQuery}*`);
params.append("title_search", `wfts(english).${searchQuery}`);
}
switch (sortBy) {

View File

@@ -10,7 +10,7 @@ export const load: PageServerLoad = async ({ params, fetch, cookies, url, parent
const baseFetchUrl = `${API_BASE_PREFIX}/article?website_id=eq.${params.websiteId}&select=id,title`;
if (searchQuery) {
parameters.append("title", `ilike.*${searchQuery}*`);
parameters.append("title_description_search", `wfts(english).${searchQuery}`);
}
switch (sortBy) {

View File

@@ -18,7 +18,7 @@ export const load: PageServerLoad = async ({ parent, params, cookies, fetch }) =
};
export const actions: Actions = {
default: async ({ fetch, cookies, request, params, locals }) => {
default: async ({ fetch, cookies, request, params }) => {
const data = await request.formData();
const coverFile = data.get("cover-image") as File;