fix: use hybrid as fallback for post search
This commit is contained in:
parent
588fe4d29a
commit
0a055d82a7
|
@ -27,8 +27,7 @@ export default async function handler(
|
|||
blocks: [],
|
||||
}
|
||||
|
||||
result.blocks = await unbodyApi
|
||||
.searchPostBlocks({
|
||||
const query: Parameters<(typeof unbodyApi)['searchPostBlocks']>[0] = {
|
||||
tags,
|
||||
type: ['text', 'image'],
|
||||
postId: Array.isArray(id) ? id[0] : id,
|
||||
|
@ -38,7 +37,15 @@ export default async function handler(
|
|||
|
||||
limit: parseInt(limit, 50),
|
||||
skip: parseInt(skip, 0),
|
||||
})
|
||||
}
|
||||
|
||||
result.blocks = await unbodyApi
|
||||
.searchPostBlocks(query)
|
||||
.then((res) => res.data)
|
||||
|
||||
if (result.blocks.length === 0)
|
||||
result.blocks = await unbodyApi
|
||||
.searchPostBlocks({ ...query, method: 'hybrid' })
|
||||
.then((res) => res.data)
|
||||
|
||||
res.status(200).json({
|
||||
|
|
Loading…
Reference in New Issue