Skip to content

Commit cf33d54

Browse files
committed
fix docker-compose.yml
1 parent dbb76c1 commit cf33d54

3 files changed

Lines changed: 7 additions & 10 deletions

File tree

backend/app/models/paper.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@ class Paper(Base):
2626

2727
__tablename__ = "paper"
2828

29-
# ------------------
3029
# Columns
31-
# ------------------
3230
paper_id: Mapped[int] = mapped_column(BigInteger, primary_key=True, index=True)
3331
doi: Mapped[str] = mapped_column(String(255), nullable=False, unique=True)
3432

@@ -54,16 +52,12 @@ class Paper(Base):
5452
DateTime(timezone=True), nullable=False, server_default=func.now()
5553
)
5654

57-
# ------------------
5855
# Vector Embedding
59-
# ------------------
6056
embedding: Mapped[Optional[List[float]]] = mapped_column(
6157
Vector(768), nullable=True
6258
)
6359

64-
# ------------------
6560
# Relationships
66-
# ------------------
6761
project_links: Mapped[List["ProjectPaper"]] = relationship(
6862
"ProjectPaper", back_populates="paper", cascade="all, delete-orphan"
6963
)
@@ -72,15 +66,16 @@ class Paper(Base):
7266
"Project", secondary="project_paper", back_populates="papers"
7367
)
7468

75-
# ------------------
7669
# Indexes (HNSW)
77-
# ------------------
7870
__table_args__ = (
7971
Index(
8072
"ix_paper_embedding_hnsw",
8173
"embedding",
8274
postgresql_using="hnsw",
83-
postgresql_with={"m": 16, "ef_search": 40, "lists": 100},
75+
postgresql_ops={
76+
"embedding": "vector_cosine_ops"
77+
},
78+
postgresql_with={"m": 16, "ef_construction": 64},
8479
),
8580
)
8681

docker-compose.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ services:
99
ports:
1010
- "5433:5432"
1111
volumes:
12-
- postgres_data:/var/lib/postgresql/data
12+
- postgres_data:/var/lib/postgresql
13+
- ./docker/init:/docker-entrypoint-initdb.d
1314
restart: unless-stopped
1415

1516
volumes:

docker/init/01-vector.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CREATE EXTENSION IF NOT EXISTS vector;

0 commit comments

Comments
 (0)