feat: add initial recommendation data

This commit is contained in:
2023-09-08 13:33:29 +02:00
parent 517b1ba23d
commit cc112b7554
19 changed files with 289 additions and 170 deletions

View File

@@ -1,4 +1,3 @@
import { BadRequestError } from "@lib/errors.ts";
import { resources } from "@lib/resources.ts";
import { SearchResult } from "@lib/types.ts";
import { getTypeSenseClient } from "@lib/typesense.ts";
@@ -15,9 +14,9 @@ type SearchParams = {
query_by?: string;
};
export function parseResourceUrl(_url: string): SearchParams | undefined {
export function parseResourceUrl(_url: string | URL): SearchParams | undefined {
try {
const url = new URL(_url);
const url = typeof _url === "string" ? new URL(_url) : _url;
let query = url.searchParams.get("q") || "*";
if (!query) {
return undefined;