diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 018139a..7f6ffe0 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -33,7 +33,7 @@ jobs: matrix: arch: ["x86_64", "aarch64"] env: - PGRX_IMAGE: "kemingy/pgrx:0.12.8" + PGRX_IMAGE: "ghcr.io/tensorchord/vectorchord-pgrx:0.12.8" steps: - uses: actions/checkout@v4 diff --git a/Cargo.toml b/Cargo.toml index 8bf165b..9b8bff2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "pg_bm25" +name = "vchord_bm25" version = "0.0.0" edition = "2021" @@ -7,7 +7,7 @@ edition = "2021" crate-type = ["cdylib", "lib"] [[bin]] -name = "pgrx_embed_pg_bm25" +name = "pgrx_embed_vchord_bm25" path = "./src/bin/pgrx_embed.rs" [features] diff --git a/pg_bm25.control b/pg_bm25.control deleted file mode 100644 index 551c078..0000000 --- a/pg_bm25.control +++ /dev/null @@ -1,6 +0,0 @@ -comment = 'pg_bm25: Created by pgrx' -default_version = '@CARGO_VERSION@' -module_pathname = '$libdir/pg_bm25' -relocatable = false -superuser = true -schema = bm25_catalog diff --git a/rust-toolchain.toml b/rust-toolchain.toml deleted file mode 100644 index edfb957..0000000 --- a/rust-toolchain.toml +++ /dev/null @@ -1,2 +0,0 @@ -[toolchain] -channel = "nightly-2024-09-14" diff --git a/src/datatype/memory_bm25vector.rs b/src/datatype/memory_bm25vector.rs index 2ec0849..571915f 100644 --- a/src/datatype/memory_bm25vector.rs +++ b/src/datatype/memory_bm25vector.rs @@ -58,7 +58,7 @@ pub enum Bm25VectorInput<'a> { Borrowed(&'a Bm25VectorHeader), } -impl<'a> Bm25VectorInput<'a> { +impl Bm25VectorInput<'_> { unsafe fn new(p: NonNull) -> Self { let q = unsafe { NonNull::new(pgrx::pg_sys::pg_detoast_datum(p.cast().as_ptr()).cast()).unwrap() @@ -129,7 +129,7 @@ impl Drop for Bm25VectorOutput { } } -impl<'a> FromDatum for Bm25VectorInput<'a> { +impl FromDatum for Bm25VectorInput<'_> { unsafe fn from_polymorphic_datum(datum: Datum, is_null: bool, _typoid: Oid) -> Option { if is_null { None diff --git a/src/index/build.rs b/src/index/build.rs index ce01969..876f331 100644 --- a/src/index/build.rs +++ b/src/index/build.rs @@ -73,7 +73,7 @@ pub unsafe extern "C" fn ambuild( index_tuples: 0, index, builder: IndexBuilder::new(), - memctx: PgMemoryContexts::new("pg_bm25_index_build"), + memctx: PgMemoryContexts::new("vchord_bm25_index_build"), }; pgrx::pg_sys::IndexBuildHeapScan(heap, index, index_info, Some(build_callback), &mut state); diff --git a/src/lib.rs b/src/lib.rs index a8ab9d3..b963343 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,4 +1,3 @@ -#![feature(doc_cfg)] #![allow(clippy::len_without_is_empty)] pub mod algorithm; diff --git a/src/segment/field_norm.rs b/src/segment/field_norm.rs index 7061f3c..c66daf9 100644 --- a/src/segment/field_norm.rs +++ b/src/segment/field_norm.rs @@ -30,7 +30,7 @@ pub trait FieldNormRead { pub struct FieldNormMemoryReader<'a>(&'a [u8]); -impl<'a> FieldNormRead for FieldNormMemoryReader<'a> { +impl FieldNormRead for FieldNormMemoryReader<'_> { fn read(&self, doc_id: u32) -> u8 { self.0[doc_id as usize] } diff --git a/src/sql/finalize.sql b/src/sql/finalize.sql index 7471498..e4add01 100644 --- a/src/sql/finalize.sql +++ b/src/sql/finalize.sql @@ -19,7 +19,7 @@ CREATE FUNCTION to_bm25query(index_oid regclass, query_str text) RETURNS bm25que $$; CREATE ACCESS METHOD bm25 TYPE INDEX HANDLER _bm25_amhandler; -COMMENT ON ACCESS METHOD bm25 IS 'pg_bm25 index access method'; +COMMENT ON ACCESS METHOD bm25 IS 'vchord bm25 index access method'; CREATE OPERATOR pg_catalog.<&> ( PROCEDURE = search_bm25query, diff --git a/tests/README.md b/tests/README.md index 7e62d65..7ec1958 100644 --- a/tests/README.md +++ b/tests/README.md @@ -1,4 +1,4 @@ -## Tests for pg_bm25.rs +## Tests for vchord_bm25 We use [sqllogictest-rs](https://github.com/risinglightdb/sqllogictest-rs) to test the SQL queries. diff --git a/tests/init.sql b/tests/init.sql index 9d3ddb6..6871646 100644 --- a/tests/init.sql +++ b/tests/init.sql @@ -1 +1 @@ -CREATE EXTENSION pg_bm25; +CREATE EXTENSION vchord_bm25; diff --git a/tests/sqllogictest/index.slt b/tests/sqllogictest/index.slt index f771fb6..c6f25f3 100644 --- a/tests/sqllogictest/index.slt +++ b/tests/sqllogictest/index.slt @@ -43,7 +43,7 @@ LIMIT 10; statement ok INSERT INTO documents (passage) VALUES -('pg_bm25 is a postgresql extension for bm25 ranking algorithm.'); +('vchord_bm25 is a postgresql extension for bm25 ranking algorithm.'); statement ok UPDATE documents SET embedding = tokenize(passage) WHERE embedding IS NULL; diff --git a/tests/sqllogictest/temp.slt b/tests/sqllogictest/temp.slt index 3b308fa..d4955ba 100644 --- a/tests/sqllogictest/temp.slt +++ b/tests/sqllogictest/temp.slt @@ -46,7 +46,7 @@ LIMIT 10; statement ok INSERT INTO documents (passage) VALUES -('pg_bm25 is a postgresql extension for bm25 ranking algorithm.'); +('vchord_bm25 is a postgresql extension for bm25 ranking algorithm.'); statement ok UPDATE documents SET embedding = tokenize(passage) WHERE embedding IS NULL; diff --git a/vchord_bm25.control b/vchord_bm25.control new file mode 100644 index 0000000..98b58bd --- /dev/null +++ b/vchord_bm25.control @@ -0,0 +1,6 @@ +comment = 'vchord_bm25: A postgresql extension for bm25 ranking algorithm' +default_version = '@CARGO_VERSION@' +module_pathname = '$libdir/vchord_bm25' +relocatable = false +superuser = true +schema = bm25_catalog