-
-
Notifications
You must be signed in to change notification settings - Fork 2
feat: [SPMVP -6521] use typesense to fetch article list in karbon to reduce api server load #281
feat: [SPMVP -6521] use typesense to fetch article list in karbon to reduce api server load #281
Conversation
const getPage = async (page: number) => { | ||
const { data } = await client.query({ query, variables: { page } }) | ||
return data.articles | ||
const documents = typesenseClient?.collections('articles').documents() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
目前不確定為什麼,在測試 sitemap 與 feed 時速度比起 front page 要來的慢很多,有辦法確定原因嗎?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
調整作法為使用 payload 作為資料來源
|
||
export const PER_PAGE = 100 | ||
|
||
export function getSearchQuery(page = 1, filter: TypesenseFilter = {}) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 這樣整理出來我覺得是很好的設計
filter_by: filterBy, | ||
per_page: PER_PAGE, | ||
page, | ||
preset: `list-articles-${page}`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💭 這個 preset 好像用法不太對,這邊應該不需要 https://typesense.org/docs/0.25.1/api/search.html#presets
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已經修正,因為型別錯誤誤以為這是必要屬性,但原因是我有漏掉其他必要屬性才會顯示缺少 preset
77dc9ed
to
9639cef
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change req delivier via slack
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉
/sitemap.xml
is functioning correctly./atom.xml
is working as expected.filter_by
feature.