RediSearch is a Redis module providing full-text search, secondary indexing, and vector similarity search.
The primary development focus is porting C code from src/ to Rust in src/redisearch_rs/.
./build.sh # Full build (C + Rust)
./build.sh DEBUG=1 # Debug build
./build.sh FORCE # Rebuild discarding previous artifacts./build.sh RUN_UNIT_TESTS # C/C++ unit tests
./build.sh RUN_UNIT_TESTS TEST=unit_test_name # Specific C/C++ unit tests
./build.sh RUN_PYTEST # Python behavioral tests
./build.sh RUN_PYTEST TEST=test_name # Specific Python test
cargo nextest run # Rust tests, from `src/redisearch_rs/`
cargo +nightly miri test # Rust tests under `miri`, from `src/redisearch_rs/`Run Rust tests from workspace root (src/redisearch_rs/):
# All Rust tests
cd src/redisearch_rs && cargo nextest run
# Rust tests for a specific crate
cd src/redisearch_rs && cargo nextest run -p <crate_name>make lint # Run clippy and cargo doc checks
make fmt # Format all code
make fmt CHECK=1 # Check formatting without changes
cd src/redisearch_rs && cargo license-fix # Add missing license headers- Edition 2024
- Document all
unsafeblocks with// SAFETY:comments - Use
#[expect(...)]over#[allow(...)]for lint suppressions - Use
tracingmacros for logging (debug!, info!, warn!, error!)
- 2-space indentation, 100-char line limit
- Pointer alignment: left (
int* p;) - No trailing spaces
src/ # C source code (being ported)
src/redisearch_rs/ # Rust codebase
├── ... # New Rust-native functionality
├── ffi/ # Rust bindings for C types and functions
├── headers/ # Autogenerated C headers for Rust types and functions in *_ffi crates
├── c_entrypoint/ # FFI layer (C bindings for Rust types and functions)
│ └── *_ffi/ # Per-module FFI crates
│ └── redisearch_rs/ # Entrypoint for Rust-native functionality used by the C codebase
├── c_wrappers/ # Idiomatic Rust APIs on top of C types
│ └── buffer, c_trie, ... # Per-type wrapper crates
└── Cargo.toml # Workspace root
Each ported module has a corresponding *_ffi crate in c_entrypoint/:
src/redisearch_rs/
├── trie_rs/ # Pure Rust implementation
└── c_entrypoint/
└── triemap_ffi/ # C-callable wrapper
Follow /rust-docs-guidelines when writing documentation for Rust code. Invoke /port-c-module to plan the porting of a C module. Invoke /write-rust-tests to add tests to Rust code. Invoke /verify to verify the correctness of your work before wrapping up. Invoke /jj-fix-conflicts to resolve conflicts in a jj changes.
/*
* Copyright (c) 2006-Present, Redis Ltd.
* All rights reserved.
*
* Licensed under your choice of the Redis Source Available License 2.0
* (RSALv2); or (b) the Server Side Public License v1 (SSPLv1); or (c) the
* GNU Affero General Public License v3 (AGPLv3).
*/