Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[Fix/pagination]- 검색결과가 없는 경우 404 error내는 오류 수정 #90

Merged
merged 3 commits into from
Dec 7, 2022

Conversation

JunYupK
Copy link
Collaborator

@JunYupK JunYupK commented Dec 6, 2022

개요

#86
해당 이슈에 관한 수정 사항입니다.

작업사항

  • search.controller 의 논문의 list의 개수에 따라 예외처리 하는 로직을 살짝 변경하였습니다.
  • page가 total page 이상으로 요청하지만, totalpage가 0인 경우는 제외하였습니다.
  • 검색결과가 없는경우 throw 404error를 처리 하던 부분을 삭제하고 빈 리스트를 response하여 front측에서 빈 리스트를 처리하도록 다시 변경하였습니다.

@github-actions github-actions bot requested review from Palwol and yeynii December 6, 2022 02:22
@@ -40,15 +40,14 @@ export class SearchController {
const data = await this.searchService.getElasticSearch(keyword, rows, rows * (page - 1));
const totalItems = (data.hits.total as SearchTotalHits).value;
const totalPages = Math.ceil(totalItems / rows);
if (page > totalPages) {
if (page > totalPages && totalPages !== 0) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

좋은 예외처리입니다.

Copy link
Collaborator

@Palwol Palwol left a comment

Choose a reason for hiding this comment

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

getAutoCompletePapers에서도 동일하게 paper.length가 0이면 에러를 던지는데, 이 부분도 그냥 빈 배열을 줘서 처리하는게 좋을 것 같습니다!

@JunYupK JunYupK merged commit de9d940 into dev Dec 7, 2022
@JunYupK JunYupK deleted the fix/pagination branch December 7, 2022 04:07
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants