|
16 | 16 | import java.util.List; |
17 | 17 | import java.util.Map; |
18 | 18 |
|
| 19 | +import static com.likelion.backendplus4.yakplus.common.util.log.LogUtil.log; |
| 20 | + |
19 | 21 | @Repository("gptAdapter") |
20 | 22 | @Primary |
21 | 23 | @RequiredArgsConstructor |
@@ -49,20 +51,29 @@ public List<Drug> loadAllEmbeddings() { |
49 | 51 | public List<Drug> loadEmbeddingsByPage(Pageable pageable) { |
50 | 52 | List<DrugRawDataEntity> rawDataEntities = govDrugJpaRepository.findAll(pageable).getContent(); |
51 | 53 | List<DrugGptEmbedEntity> drugGptEmbedEntities = govDrugGptEmbedJpaRepository.findAll(pageable).getContent(); |
| 54 | + log("loadEmbeddingsByPage - " + pageable.getPageNumber() +"ํ์ด์ง ์์ ๋ฐ์์จ drug ์์ธ์ ๋ณด ์: " + rawDataEntities.size()); |
| 55 | + log("loadEmbeddingsByPage - " + pageable.getPageNumber() +"ํ์ด์ง ์์ ๋ฐ์์จ drug ์๋ฒ ๋ฉ ๋ฒกํฐ์: " + drugGptEmbedEntities.size()); |
52 | 56 |
|
53 | 57 | // drugGptEmbedEntities๋ฅผ Map์ผ๋ก ๋ณํ (key: drugId) |
54 | 58 | Map<Long, DrugGptEmbedEntity> gptEmbedMap = new HashMap<>(); |
55 | 59 | for (DrugGptEmbedEntity embed : drugGptEmbedEntities) { |
| 60 | + log("loadEmbeddingsByPage - " +pageable.getPageNumber()+"ํ์ด์ง์์ ์๋ฒ ๋ฉ ๋ฒกํฐ ๋ฐ์์จ ์ฝํ ID: " + embed.getDrugId()); |
56 | 61 | gptEmbedMap.put(embed.getDrugId(), embed); |
57 | 62 | } |
58 | 63 |
|
59 | 64 | List<Drug> drugs = new ArrayList<>(); |
| 65 | + log("loadEmbeddingsByPage - Drug ๋๋ฉ์ธ ๊ฐ์ฒด ์์ฑ ์์"); |
60 | 66 | for (DrugRawDataEntity drugRawData : rawDataEntities) { |
61 | 67 | DrugGptEmbedEntity embed = gptEmbedMap.get(drugRawData.getDrugId()); |
| 68 | + if(embed == null) { |
| 69 | + log("loadEmbeddingsByPage - " + "Drug ๋๋ฉ์ธ ๊ฐ์ฒด ์์ฑ ๋์ " + drugRawData.getDrugId() + "์ ๋ฒกํฐ๊ฐ ์์ผ๋ฏ๋ก skip"); |
| 70 | + continue; |
| 71 | + } |
| 72 | + log("loadEmbeddingsByPage - Drug ๋๋ฉ์ธ ๊ฐ์ฒด ์์ฑ ๋์ " + drugRawData.getDrugId() + "์ ๋ฒกํฐ ๊ธธ์ด: " + embed.getGptVector().length()); |
62 | 73 | Drug drug = toDomainFromEntity(drugRawData, embed); |
63 | 74 | drugs.add(drug); |
64 | 75 | } |
65 | | - |
| 76 | + log("loadEmbeddingsByPage - Drug ๋๋ฉ์ธ ๊ฐ์ฒด ์์ฑ ์๋ฃ"); |
66 | 77 | return drugs; |
67 | 78 | } |
68 | 79 |
|
|
0 commit comments