Search service: adding more attributes to highlights

This commit is contained in:
Wayne
2025-07-20 21:56:06 +03:00
parent bde3a92411
commit 9c40a6c63b
4 changed files with 9 additions and 6 deletions

View File

@@ -228,11 +228,10 @@ export class IngestionService {
}
// adding to indexing queue
//Instead: index by email (raw email object, ingestion id)
console.log('adding to indexing queue');
console.log('Indexing email: ', email.subject);
// await indexingQueue.add('index-email', {
// emailId: archivedEmail.id,
// });
const searchService = new SearchService();
const storageService = new StorageService();
const databaseService = new DatabaseService();

View File

@@ -40,7 +40,7 @@ export class SearchService {
const searchParams: SearchParams = {
limit,
offset: (page - 1) * limit,
attributesToHighlight: ['body', 'attachments.*.content'],
attributesToHighlight: ['body', 'attachments.*.content', 'from', 'to', 'subject', 'cc', 'bcc'],
showMatchesPosition: true,
sort: ['timestamp:desc']
};

View File

@@ -1,9 +1,9 @@
<footer class=" bg-foreground border-t py-6 md:py-0">
<footer class=" bg-muted py-6 md:py-0">
<div
class="container mx-auto flex flex-col items-center justify-center gap-4 md:h-24 md:flex-row"
>
<div class="flex flex-col items-center gap-2">
<p class=" text-muted text-balance text-center text-sm leading-loose">
<p class=" text-balance text-center text-xs font-medium leading-loose">
© {new Date().getFullYear()} Open Archiver. All rights reserved.
</p>
</div>

View File

@@ -9,9 +9,11 @@
CardTitle,
CardDescription
} from '$lib/components/ui/card';
import type { SearchResult } from '@open-archiver/types';
let { data, form }: { data: PageData; form: ActionData } = $props();
const searchResult = form?.searchResult ?? data.searchResult;
console.log(searchResult);
const query = form?.query ?? data.query;
const error = form?.error;
@@ -27,6 +29,8 @@
.replace('</html>', '');
}
function getHighlightedHTMLFormatted(formatted: SearchResult['hits']) {}
function getHighlightedHTML(
text: string,
positions: { start: number; length: number }[]
@@ -106,7 +110,7 @@
<div class="container mx-auto p-4 md:p-8">
<h1 class="mb-4 text-2xl font-bold">Email Search</h1>
<form method="POST" class="mb-8 flex items-center gap-2">
<form method="POST" action="/dashboard/search" class="mb-8 flex items-center gap-2">
<Input
type="search"
name="query"