Add BM25-based full-text search with CJK (jieba) tokenization, supporting
query_string and match_string syntax, phrase queries, boolean operators
(AND/OR/NOT/MUST), and hybrid retrieval with existing vector search.
## Core
- BitPacked posting format with block-max WAND pruning
- Tokenizer pipeline: jieba (cut/cut_for_search/hmm/full), whitespace,
lowercase, with extensible pipeline composition
- Query parser: boolean operators, phrase queries, field scoping,
boost, MUST(+) modifier inside OR (ES query_string semantics)
- AST rewriter: dedup repeated terms with linear boost aggregation,
flatten same-type composites, canonicalize OR-with-must_not into AND
wrapper, empty-node propagation, contradiction detection
- FTS reduce/merge integrated into Optimize compaction
- Multi-segment score-descending sort
- Auto-register bundled jieba dict on SDK import
## Performance
- Block-max WAND with cached block_max_info_for (single binary search)
- AVX2/SSE bitpacked encoding with cross-arch scalar fallback
- MultiGet for batch posting retrieval and phrase position verification
- HashSkipList memtable for posting writes
- PinnableSlice zero-copy reads
- Filter pushdown into composite iterators (Disjunction/Conjunction/Phrase)
- Candidate-driven (brute-force) evaluation for selective invert filters
- Precomputed BM25 IDF weights, cached SIMD dispatch pointers
- Shortest-list anchor for phrase position matching
- Single-open per-term posting iterator
## Query
- Tokenize query terms through the same pipeline as indexing
- EmptyNode for zero-token queries (all stop-words / punctuation)
- Backslash unescape after lexing in query parser
- Schema allows collections without vector fields (FTS-only use case)
- Create/Drop Index validates supported index types
- FTS fields disallowed in SQL filter expressions
## Bindings
- C API: fts query params, brute-force ratio config
- Python SDK: FTS search, jieba dict auto-registration
## Internals
- Bypass cppjieba::Jieba to drop KeywordExtractor (~12MB fewer required files)
- Hide tokenizer pipeline from public header (Pimpl-style FtsState)
- ListColumnFamilies to avoid double-open on segment load
- Reorganized fts_column into tokenizer/, posting/, iterator/ subdirs
54 lines
1.5 KiB
CMake
54 lines
1.5 KiB
CMake
include(${PROJECT_ROOT_DIR}/cmake/bazel.cmake)
|
|
include(${PROJECT_ROOT_DIR}/cmake/option.cmake)
|
|
|
|
cc_proto_library(
|
|
NAME zvec_proto STATIC
|
|
SRCS proto/*.proto
|
|
PROTOROOT ./
|
|
)
|
|
|
|
cc_directory(common)
|
|
cc_directory(index)
|
|
cc_directory(sqlengine)
|
|
|
|
file(GLOB_RECURSE ALL_DB_SRCS *.cc *.c *.h)
|
|
|
|
# Ensure bitpacked_simd_sse41.cc is compiled with SSE4.1 flag and
|
|
# bitpacked_simd_avx2.cc with AVX2 flag in the packed zvec_db target as well
|
|
# (they are also compiled separately in zvec_index).
|
|
if(NOT ANDROID AND AUTO_DETECT_ARCH)
|
|
if(HOST_ARCH MATCHES "^(x86|x64)$")
|
|
setup_compiler_march_for_x86(_DB_MARCH_SSE _DB_MARCH_AVX2 _DB_MARCH_AVX512 _DB_MARCH_AVX512FP16)
|
|
set_source_files_properties(
|
|
${CMAKE_CURRENT_SOURCE_DIR}/index/column/fts_column/posting/bitpacked_simd_sse41.cc
|
|
PROPERTIES COMPILE_FLAGS "${_DB_MARCH_SSE}"
|
|
)
|
|
set_source_files_properties(
|
|
${CMAKE_CURRENT_SOURCE_DIR}/index/column/fts_column/posting/bitpacked_simd_avx2.cc
|
|
PROPERTIES COMPILE_FLAGS "${_DB_MARCH_AVX2}"
|
|
)
|
|
endif()
|
|
endif()
|
|
|
|
cc_library(
|
|
NAME zvec_db STATIC STRICT SRCS_NO_GLOB PACKED
|
|
SRCS ${ALL_DB_SRCS} ${CMAKE_CURRENT_BINARY_DIR}/proto/zvec.pb.cc
|
|
INCS . ${CMAKE_CURRENT_BINARY_DIR}
|
|
PUBINCS ${PROJECT_ROOT_DIR}/src/include
|
|
LIBS
|
|
zvec_ailego
|
|
zvec_core
|
|
glog
|
|
roaring
|
|
rocksdb
|
|
antlr4
|
|
libprotobuf
|
|
FastPFOR
|
|
cppjieba
|
|
Arrow::arrow_static
|
|
Arrow::arrow_compute
|
|
Arrow::arrow_dataset
|
|
Arrow::arrow_acero
|
|
DEPS zvec_proto
|
|
VERSION "${PROXIMA_ZVEC_VERSION}"
|
|
) |