package com.pharmacopoeia.repository; import com.pharmacopoeia.entity.DrugChunk; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import java.util.List; public interface DrugChunkRepository extends JpaRepository { List findByDrugId(String drugId); List findByDrugIdOrderByChunkIndexAsc(String drugId); @Query("SELECT COUNT(c) FROM DrugChunk c WHERE c.vec IS NOT NULL") long countWithVector(); @Query("SELECT COUNT(DISTINCT c.drugId) FROM DrugChunk c WHERE c.vec IS NOT NULL") long countDistinctDrugsWithVector(); }