blob: cc2a1c8e6b1561ec714d05bd774fa8d17fb423eb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
import { getPublishedPosts } from '@/lib/payload-posts';
import { createSearchAPI } from 'fumadocs-core/search/server';
// 动态生成搜索索引
export async function GET(request: Request) {
const { posts } = await getPublishedPosts({ limit: 1000 });
const indexes = posts.map((post) => ({
title: post.title,
description: post.description,
id: post.url,
url: post.url,
}));
const searchAPI = createSearchAPI('advanced', {
indexes,
});
return searchAPI.GET(request);
}
|