Repository navigation
Any plan for BM25 and inverted index like lucene for Full text search? #4664
|
Hi, Full text search: ArcadeDB documentation mentions Lucene based full-text indexing. Are BM25/IDF style scoring, field boosts, analysers, score explanations, or ranking tuning options exposed or planned for more advanced retrieval workloads? |
Replies: 3 comments 2 replies
|
From current Full-text search is already Lucene-backed: CREATE INDEX ON Article (content) FULL_TEXT;
SELECT FROM Article WHERE content CONTAINSTEXT 'java';The full-text index builder also exposes analyzer configuration: default analyzer, separate index/query analyzers, per-field analyzers, Hybrid retrieval also exists as separate building blocks. There is What I do not see as fully unified yet is automatic BM25 text -> sparse vector inside the same storage/query path. The vector comparison doc still describes this as future/unification work: ArcadeDB has Lucene full-text and sparse vectors, but the built-in BM25/full-text-as-sparse-vector function is not the same thing as a first-class unified hybrid index yet. For your workload today I would probably model it as:
So the short answer is: Lucene-like full text and hybrid fusion are already present, but first-class BM25-as-a-native-sparse-vector pipeline still looks like the missing roadmap item. |
|
Hi @sreekanthedayar, thanks for the detailed write-up - this is exactly the kind of workload ArcadeDB is built for, and @krotname's summary above is largely accurate. Let me give you the authoritative picture from What ArcadeDB already hasFull-text search - Vector search - Hybrid retrieval - Graph-aware retrieval - this is the part that's hard to do well in CrateDB. Your bounded multi-hop expansion (related cases, circulars, orders, attachments, evidence chains) can be expressed natively with SQL Where ArcadeDB does more than CrateDB for your use case
The gap you correctly identifiedYou're right: the Note that BM25-style IDF scoring does already exist in the What we're doing about itI've opened #4687 to add native BM25 full-text scoring (TF/IDF + document-length normalization, configurable For your government/legal, accuracy-over-latency profile I'd suggest: dense |
|
Native BM25 full-text scoring has landed (implemented in #4695, merged) and the documentation is updated. What's in
Note One behavior change for existing CLASSIC indexes: ExamplesCreate a BM25 index (default) and rank with CREATE INDEX ON Article (content) FULL_TEXT;
SELECT title, $score FROM Article
WHERE SEARCH_INDEX('Article[content]', 'java database') = true
ORDER BY $score DESC;Boost a single word with the Lucene caret ( SELECT title, $score FROM Article
WHERE SEARCH_INDEX('Article[content]', 'java^3 database') = true
ORDER BY $score DESC;Tune parameters and add a per-field boost on a multi-property index: CREATE INDEX ON Article (title, body) FULL_TEXT
METADATA { "similarity": "BM25", "bm25_k1": 1.2, "bm25_b": 0.75, "title_boost": 3.0 };
-- field-qualified + caret boost: weight a title match 5x
SELECT title, $score FROM Article
WHERE SEARCH_INDEX('Article[title,body]', '+database title:java^5') = true
ORDER BY $score DESC;Inspect the scoring with EXPLAIN: EXPLAIN SELECT title, $score FROM Article
WHERE SEARCH_INDEX('Article[content]', 'java database') = true;Hybrid retrieval - fuse BM25 + dense + sparse with RRF (the pattern you described): SELECT title, score FROM (
SELECT expand(`vector.fuse`(
`vector.neighbors`('Case[dense]', :denseVec, 100),
`vector.sparseNeighbors`('Case[tokens,weights]', :qIdx, :qVal, 100),
(SELECT @rid, $score FROM Case WHERE SEARCH_INDEX('Case[content]', :keywords) = true),
{ fusion: 'RRF', k: 60 }
))
) ORDER BY score DESC LIMIT 10;To switch an existing index to BM25, rebuild it ( Thanks again for the detailed use case that drove this! |
Hi @sreekanthedayar, thanks for the detailed write-up - this is exactly the kind of workload ArcadeDB is built for, and @krotname's summary above is largely accurate. Let me give you the authoritative picture from
main, including where you're right about a current limitation.What ArcadeDB already has
Full-text search -
FULL_TEXTindex withCONTAINSTEXT,SEARCH_INDEX(),SEARCH_FIELDS(). Lucene is used for analyzers/tokenizers/stemmers and query parsing, with configurable default/index/query analyzers, per-field analyzers,defaultOperator(AND/OR) andallowLeadingWildcard.Vector search -
LSM_VECTOR(dense, HNSW via JVector 4.0) andLSM_SPARSE_VECTOR(BlockMax-WAND DAAT with Robertson-Spar…