diff --git a/poetry.lock b/poetry.lock index b207e92..4429f28 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 1.7.1 and should not be changed by hand. +# This file is automatically @generated by Poetry 1.8.3 and should not be changed by hand. [[package]] name = "aiofiles" @@ -6813,4 +6813,4 @@ ragas = ["ragas"] [metadata] lock-version = "2.0" python-versions = ">=3.10,<4.0" -content-hash = "b3a14066711fe4caec356d0aa18514495d44ac253371d2560fc0c5aea890aaef" +content-hash = "239db3c85866a30b063fa6dfe538bbbe92ba659419e47446d5529fbd5bb3831a" diff --git a/src/raglite/_database.py b/src/raglite/_database.py index c339c82..8d6c179 100644 --- a/src/raglite/_database.py +++ b/src/raglite/_database.py @@ -368,11 +368,9 @@ def create_database_engine(config: RAGLiteConfig | None = None) -> Engine: with Session(engine) as session: metrics = {"cosine": "cosine", "dot": "ip", "euclidean": "l2", "l1": "l1", "l2": "l2"} session.execute( - text( - """ - CREATE INDEX IF NOT EXISTS keyword_search_chunk_index ON chunk USING GIN (to_tsvector('simple', body)); - """ - ) + text(""" + CREATE INDEX IF NOT EXISTS keyword_search_chunk_index ON chunk USING GIN (to_tsvector('simple', body)); + """) ) create_vector_index_sql = f""" CREATE INDEX IF NOT EXISTS vector_search_chunk_index ON chunk_embedding @@ -382,7 +380,7 @@ def create_database_engine(config: RAGLiteConfig | None = None) -> Engine: ); SET hnsw.ef_search = {20 * 4 * 8}; """ - # Add iterative scan if version >= 0.8.0 + # Enable iterative scan for pgvector v0.8.0 and up. pgvector_version = _pgvector_version(session) if pgvector_version and pgvector_version >= version.parse("0.8.0"): create_vector_index_sql += f"\nSET hnsw.iterative_scan = {'relaxed_order' if config.reranker else 'strict_order'};"