Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
713f331
[feat] - 기존 한국어 분석소 제거 및 LLM으로 변경, 프롬프트 최적화
IforCU Dec 24, 2025
fe10a43
Merge pull request #240 from IforCU/NEWSTAGRAM-165-프롬프트-검색-엔진-최적화
IforCU Dec 24, 2025
a27d41f
Merge pull request #241 from newstagram/develop
IforCU Dec 24, 2025
844ae77
[fix] - api/ArticleRepository: findByEmbeddingSimilarity 쿼리 수정
hyunjo01 Dec 26, 2025
1b82c35
[feat] - HomeIssueService: 시작 날짜 확인 로그 추가
hyunjo01 Dec 26, 2025
36388bc
[chore] - DB 연결 SSL 설정
IforCU Dec 26, 2025
0c083f0
Merge pull request #243 from IforCU/hotfix
IforCU Dec 26, 2025
bc0293b
Merge pull request #242 from newstagram/develop
hyunjo01 Dec 26, 2025
a3f79b6
[chore] - DB SSL 설정 변경
IforCU Dec 26, 2025
b1c91e2
Merge pull request #244 from IforCU/hotfix
IforCU Dec 26, 2025
aeabed6
Merge pull request #245 from newstagram/develop
IforCU Dec 26, 2025
76e98bf
[fix] - 연결 갯수 롤백
IforCU Dec 26, 2025
1f97bd5
Merge pull request #246 from IforCU/hotfix
IforCU Dec 26, 2025
3aa9a96
Merge pull request #247 from newstagram/develop
IforCU Dec 26, 2025
48c2682
[feat] - ArticleRepository: 타임존 추가
hyunjo01 Dec 26, 2025
fc824e1
[feat] - HomeIssueService: 로그 추가
hyunjo01 Dec 26, 2025
fcad7d3
Merge pull request #248 from newstagram/develop
hyunjo01 Dec 26, 2025
fea6ea4
[fix] - ArticleRepository: findByEmbeddingSimilarity 쿼리 수정
hyunjo01 Dec 26, 2025
6bf3cad
Merge pull request #249 from newstagram/develop
hyunjo01 Dec 26, 2025
628a016
[fix] - 쿼리문에서 애매한 startdate 처리 구문 제거
IforCU Dec 26, 2025
d404442
Merge branch 'develop' into hotfix
IforCU Dec 26, 2025
1b0cbbd
Merge pull request #250 from IforCU/hotfix
IforCU Dec 26, 2025
9168c65
Merge pull request #251 from newstagram/develop
IforCU Dec 26, 2025
b1216b8
[fix] - limit 제거
IforCU Dec 26, 2025
6661da0
Merge pull request #252 from IforCU/develop
IforCU Dec 26, 2025
551647f
Merge pull request #253 from newstagram/develop
IforCU Dec 26, 2025
b35bf05
[fix] - 모델 변경
IforCU Dec 26, 2025
1253445
Merge branch 'newstagram:develop' into develop
IforCU Dec 26, 2025
b5dd37f
Merge pull request #254 from IforCU/develop
IforCU Dec 26, 2025
544ad66
Merge pull request #255 from newstagram/develop
IforCU Dec 26, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,10 @@ public interface ArticleRepository extends JpaRepository<Article, Long> {

List<Article> findByCategory_IdOrderByPublishedAtDesc(Long categoryId, Pageable pageable);

@Query(value = "SELECT id, title, content, description, url, thumbnail_url, author, published_at, created_at, updated_at, feed_id, category_id, sources_id, NULL as embedding FROM articles ORDER BY embedding <=> cast(:embedding as vector) LIMIT :limit", nativeQuery = true)
List<Article> findByEmbeddingSimilarity(@Param("embedding") String embedding, @Param("limit") int limit);

@Query(value = "SELECT id, title, content, description, url, thumbnail_url, author, published_at, created_at, updated_at, feed_id, category_id, sources_id, NULL as embedding " +
"FROM articles " +
"WHERE (:categoryId IS NULL OR category_id = :categoryId) " +
"AND (cast(:startDate as timestamp) IS NULL OR published_at >= cast(:startDate as timestamp)) " +
"AND published_at >= cast(:startDate as timestamp) " +
"AND (embedding <=> cast(:embedding as vector)) < :threshold " +
"ORDER BY embedding <=> cast(:embedding as vector) " +
"LIMIT :limit OFFSET :offset", nativeQuery = true)
Expand All @@ -55,22 +52,21 @@ List<Article> findByEmbeddingSimilarityWithFilters(

@Query(value = "SELECT id, title, content, description, url, thumbnail_url, author, published_at, created_at, updated_at, feed_id, category_id, sources_id, NULL as embedding " +
"FROM articles " +
"WHERE (cast(:startDate as timestamp) IS NULL OR published_at >= cast(:startDate as timestamp)) " +
"WHERE published_at >= cast(:startDate as timestamp) " +
"ORDER BY embedding <=> cast(:embedding as vector) " +
"LIMIT :limit", nativeQuery = true)
List<Article> findByEmbeddingSimilarity(
@Param("embedding") String embedding,
@Param("limit") int limit,
@Param("startDate") LocalDateTime startDate
);

@Query(value = "SELECT id, title, content, description, url, thumbnail_url, author, published_at, created_at, updated_at, feed_id, category_id, sources_id, NULL as embedding " +
"FROM articles " +
"WHERE (:categoryIds IS NULL OR category_id IN (:categoryIds)) " +
"AND (cast(:startDate as timestamp) IS NULL OR published_at >= cast(:startDate as timestamp)) " +
"AND published_at >= cast(:startDate as timestamp) " +
"AND (embedding <=> cast(:embedding as vector)) < :threshold " +
"ORDER BY embedding <=> cast(:embedding as vector) " +
"LIMIT :limit", nativeQuery = true)
"ORDER BY embedding <=> cast(:embedding as vector) ", nativeQuery = true)
List<Article> findCandidatesByEmbedding(
@Param("embedding") String embedding,
@Param("limit") int limit,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ public class HomeIssueService {

public List<ArticleDto> findByEmbeddingSimilarity(String embedding, int limit, LocalDateTime startDate) {
List<Article> articles = articleRepository.findByEmbeddingSimilarity(embedding, limit, startDate);
log.info("[HomeIssueService] startDate:{}", startDate);
log.info("[HomeIssueService] articles.size:{}", articles.size());
// Article 리스트를 ArticleDto 리스트로 변환
return articles.stream()
.map(this::toArticleDto) // toArticleDto 메소드 사용
Expand Down
Loading