aboutsummaryrefslogtreecommitdiff
path: root/web/src/Doc.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'web/src/Doc.tsx')
-rw-r--r--web/src/Doc.tsx39
1 files changed, 1 insertions, 38 deletions
diff --git a/web/src/Doc.tsx b/web/src/Doc.tsx
index 44d120e..d0af81d 100644
--- a/web/src/Doc.tsx
+++ b/web/src/Doc.tsx
@@ -1,42 +1,5 @@
-import z from 'zod';
import './Doc.css'
-
-export interface ResultDoc {
- /** The document ID */
- id: number,
- /** The Score returned by pylucene */
- score: number,
- /** The domain of the result */
- domain: string,
- /** The full URL of the result */
- url: string,
- /** The title of the webpage */
- title: string,
- /** All the image URLs in the site */
- images: string[],
- /** The parsed content */
- content: string,
-}
-
-const resultDocSchema = z.object({
- id: z.number().int(),
- score: z.number(),
- domain: z.string(),
- url: z.string(),
- title: z.string(),
- images: z.string().array(),
- content: z.string(),
-})
-
-export function isResultDoc(doc: unknown): doc is ResultDoc {
- const result = resultDocSchema.safeParse(doc);
- if (!result.success) {
- console.error(result.error);
- return false;
- } else {
- return true;
- }
-}
+import {ResultDoc} from "./resultdoc.ts";
export interface DocParams {
document: ResultDoc,