Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,6 @@ QSTASH_URL=
QSTASH_TOKEN=
QSTASH_CURRENT_SIGNING_KEY=
QSTASH_NEXT_SIGNING_KEY=

# Search
UPSTASH_SEARCH_URL=
UPSTASH_SEARCH_TOKEN=
```

### Run using Docker
Expand Down
24 changes: 0 additions & 24 deletions app/(api)/api/webhook/auth/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
accountDeletedPlainText,
} from "@/components/emails/account-deleted";
import * as schema from "@/drizzle/schema";
import { SearchService } from "@/lib/search";
import {
deleteDatabase,
getDatabaseForOwner,
Expand Down Expand Up @@ -271,15 +270,6 @@ export async function POST(req: NextRequest) {
console.error("Error deleting user database:", err);
}

// Delete search index for user
try {
const userSearch = new SearchService(id, "me");
await userSearch.deleteTenantIndex();
console.log("User search index deleted successfully");
} catch (err) {
console.error("Error deleting user search index:", err);
}

// Also delete user from ops database
try {
const db = await getOpsDatabase();
Expand Down Expand Up @@ -334,20 +324,6 @@ export async function POST(req: NextRequest) {
);
}

// Delete search index for organization
try {
const orgSearch = new SearchService(id, id); // slug is not relevant for deleting
await orgSearch.deleteTenantIndex();
console.log(
`[Webhook] Organization search index deleted successfully for ID: ${id}`,
);
} catch (err) {
console.error(
`[Webhook] Error deleting organization search index for ID: ${id}:`,
err,
);
}

// Send deletion confirmation email if we have org data
if (orgData) {
try {
Expand Down
2 changes: 1 addition & 1 deletion biome.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "https://biomejs.dev/schemas/2.0.6/schema.json",
"$schema": "https://biomejs.dev/schemas/2.3.5/schema.json",
"assist": { "actions": { "source": { "organizeImports": "on" } } },
"linter": {
"enabled": true,
Expand Down
610 changes: 27 additions & 583 deletions bun.lock

Large diffs are not rendered by default.

44 changes: 3 additions & 41 deletions components/core/search-panel.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use client";

import { useMutation, useQuery } from "@tanstack/react-query";
import { useQuery } from "@tanstack/react-query";
import { groupBy } from "es-toolkit";
import {
AlertCircle,
Expand All @@ -10,14 +10,13 @@ import {
FileText,
Filter,
FolderOpen,
Loader2,
MessagesSquare,
RefreshCw,
Search,
X,
} from "lucide-react";
import { useRouter } from "next/navigation";
import { useCallback, useEffect, useState } from "react";
import { toast } from "sonner";
import { useDebounce } from "use-debounce";
import { HtmlPreview } from "@/components/core/html-view";
import { Badge } from "@/components/ui/badge";
Expand Down Expand Up @@ -133,35 +132,15 @@ export function SearchSheet({ open, onOpenChange }: SearchSheetProps) {
enabled: debouncedQuery.length > 0 && open,
});

// Fetch projects for project filter
const { data: projects = [] } = useQuery(
trpc.user.getProjects.queryOptions(),
);

const indexAllMutation = useMutation(
trpc.search.indexAllContent.mutationOptions(),
);

const handleItemClick = (url: string) => {
onOpenChange(false);
router.push(url);
};

const handleReindexAll = async () => {
try {
const result = await indexAllMutation.mutateAsync();
toast.success("Content reindexed successfully!", {
description: `Indexed ${result.indexed.projects} projects, ${result.indexed.taskLists} task lists, ${result.indexed.tasks} tasks, ${result.indexed.events} events, and ${result.indexed.posts} posts.`,
});
} catch (err) {
console.error("Error reindexing content:", err);
toast.error("Failed to reindex content", {
description:
"Please try again or contact support if the problem persists.",
});
}
};

const clearFilter = useCallback(() => {
setTypeFilter(undefined);
setProjectFilter(undefined);
Expand Down Expand Up @@ -382,25 +361,8 @@ export function SearchSheet({ open, onOpenChange }: SearchSheetProps) {
)}
</div>
</div>

<Button
variant="outline"
size="sm"
onClick={handleReindexAll}
disabled={indexAllMutation.isPending}
className="gap-2"
>
<RefreshCw
className={cn(
"h-4 w-4",
indexAllMutation.isPending && "animate-spin",
)}
/>
{indexAllMutation.isPending ? "Indexing..." : "Reindex All"}
</Button>
</div>

{/* Results */}
<div className="space-y-4">
{debouncedQuery.length === 0 ? (
<div className="border rounded-lg p-8">
Expand All @@ -418,7 +380,7 @@ export function SearchSheet({ open, onOpenChange }: SearchSheetProps) {
) : isLoading ? (
<div className="border rounded-lg p-8">
<div className="flex items-center justify-center">
<RefreshCw className="h-6 w-6 animate-spin mr-2" />
<Loader2 className="h-6 w-6 animate-spin mr-2" />
<span>Searching...</span>
</div>
</div>
Expand Down
Loading