Skip to content

Commit

Permalink
refactor: BM25도 검색 결과 5개로 제한
Browse files Browse the repository at this point in the history
안쓰는 검색 삭제
  • Loading branch information
inpink committed Sep 30, 2024
1 parent c161ae0 commit c345eec
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,31 +60,6 @@ public String researchResult(@RequestParam("query") String query, Model model) {
refinedPredictedClass,
5);

List<BasePostRequest> sortingAlgorithm = searchService.searchResults(
words,
query,
5,
model);

List<BasePostRequest> sortingResnetTransformer = searchService.searchResultsWithSortingAlgorithm(
words,
query,
refinedPredictedClass,
5,
model,
2
);

// 가중치 3인 버전
List<BasePostRequest> sortingResnetTransformerWeight3 = searchService.searchResultsWithSortingAlgorithm(
words,
query,
refinedPredictedClass,
5,
model,
3
);

// bm25만
List<BasePostRequest> bm25 = searchService.searchResultsWithBM25(
query
Expand All @@ -100,9 +75,6 @@ public String researchResult(@RequestParam("query") String query, Model model) {

model.addAttribute("beforeKNU", beforeKNU);
model.addAttribute("knuPlusAi", knuPlusAi);
model.addAttribute("sortingAlgorithm", sortingAlgorithm);
model.addAttribute("resnetTransformer", sortingResnetTransformer);
model.addAttribute("resnetTransformerWeight3", sortingResnetTransformerWeight3);
model.addAttribute("bm25", bm25);
model.addAttribute("bm25PlusAi", bm25PlusAi);

Expand Down
8 changes: 8 additions & 0 deletions src/main/java/knusearch/clear/jpa/service/SearchService.java
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,10 @@ public List<BasePostRequest> searchResultsWithBM25(String query) {
post.getClassification()
);
result.add(request);

if (result.size()>=5) {
break;
}
}

return result;
Expand Down Expand Up @@ -590,6 +594,10 @@ public List<BasePostRequest> searchResultsWithBM25PlusAi(String query, String re
post.getClassification()
);
result.add(request);

if (result.size()>=5) {
break;
}
}

return result;
Expand Down

0 comments on commit c345eec

Please sign in to comment.