Skip to content
This repository has been archived by the owner on Nov 20, 2024. It is now read-only.

feat: [SPMVP -6521] use typesense to fetch article list in karbon to reduce api server load #281

Conversation

SidStraw
Copy link
Contributor

@SidStraw SidStraw commented Oct 6, 2023

  • Verify that the article list and page display are normal.
  • Confirm that /sitemap.xml is functioning correctly.
  • Ensure that /atom.xml is working as expected.
  • Check the effectiveness of the filter_by feature.

@DanSnow DanSnow self-requested a review October 8, 2023 09:51
const getPage = async (page: number) => {
const { data } = await client.query({ query, variables: { page } })
return data.articles
const documents = typesenseClient?.collections('articles').documents()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

目前不確定為什麼,在測試 sitemap 與 feed 時速度比起 front page 要來的慢很多,有辦法確定原因嗎?

Copy link
Contributor Author

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 = {}) {
Copy link
Contributor

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}`,
Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已經修正,因為型別錯誤誤以為這是必要屬性,但原因是我有漏掉其他必要屬性才會顯示缺少 preset

@SidStraw SidStraw force-pushed the SPMVP-6521-use-typesense-to-fetch-article-list-in-karbon-to-reduce-api-server-load branch from 77dc9ed to 9639cef Compare October 12, 2023 01:39
@SidStraw SidStraw requested a review from DanSnow October 12, 2023 01:55
Copy link
Contributor

@DanSnow DanSnow left a 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

@SidStraw
Copy link
Contributor Author

透過其他專案驗證:

image

@SidStraw SidStraw requested a review from DanSnow October 17, 2023 06:20
Copy link
Contributor

@DanSnow DanSnow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

@DanSnow DanSnow merged commit da6c0fb into main Oct 17, 2023
1 check passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants