-
Notifications
You must be signed in to change notification settings - Fork 600
Open
Description
🐛 Bug Report: BM25 search fails with "position is not found but required for phrase queries"
Environment
- Plugin version:
[email protected] - LanceDB version:
0.26.2(bundled with plugin) - OpenClaw version: 2026.03.x (latest)
- Platform: Windows_11 (observed on Gateway)
Error
Every BM25 query fails with this error, causing a fallback to empty results:
BM25 search failed, falling back to empty results: [Error: Failed to execute query stream: GenericFailure, lance error: Invalid user input: position is not found but required for phrase queries, try recreating the index with position, ...]
Caused by: position is not found but required for phrase queries, try recreating the index with position
Root Cause
In src/store.ts, the createFtsIndex() method creates the FTS index without position data:
await table.createIndex("text", {
config: (lancedb as any).Index.fts(), // withPosition defaults to false
});Index.fts() in LanceDB 0.26.2 defaults withPosition: false. When a phrase query is executed internally (e.g., multi-word search treated as phrase), LanceDB requires position data that does not exist in the index, causing the error.
The native.d.ts signature confirms:
static fts(
withPosition?: boolean, // ← first arg, defaults to false
baseTokenizer?: string,
language?: string,
...
): IndexImpact
- All BM25/keyword searches silently fall back to empty results
- Users lose full-text search capability entirely
- Error is caught and suppressed (
console.warn), so users don't see the actual error — they just get no results
Workaround
The plugin already has rebuildFtsIndex() method in 1.1.0-beta.10 which can recreate the index. However:
- Users need to know to call it manually
- The
createFtsIndex()source code still uses the wrong default
Suggested Fix
Option A — Fix at creation time (preferred, prevents future occurrences):
// src/store.ts, createFtsIndex()
config: (lancedb as any).Index.fts(true), // explicitly enable position dataOption B — Add rebuildFtsIndex to auto-trigger when FTS query fails with this specific error, instead of just falling back silently.
Additional Notes
- The plugin already has a
rebuildFtsIndex()public method that can fix existing deployments - This error started appearing after upgrading to beta.10 / LanceDB 0.26.2 (previously on 1.0.32 with earlier LanceDB this did not occur)
- The error is 100% reproducible on any BM25 query once the index lacks position data
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels