mirror of
https://github.com/lancedb/lancedb.git
synced 2026-12-03 07:45:17 +00:00
feat(query): allow unordered vector and full-text search results (#5328)
## Summary Callers that consume every selected hit can relax the final output order with `ordered_results(false)` in Rust, `ordered_results(False)` in Python, or `orderedResults(false)` in TypeScript. Ranked output remains the default. The option preserves top-k selection, each hit’s score and projected columns, and the existing rules for ties at the cutoff. Embedded passes eligible queries to the Lance scanner. Enterprise sends `"ordered": false` for eligible searches and omits the field by default. Explicit sorting, positive offsets, batch vector queries and inputs to hybrid fusion or reranking keep their existing order. ## Validation A managed Linux preview passed 8 Rust wire cases, 4 Embedded Python cases, 10 HTTP mock cases and all 52 TypeScript query tests. The preview used a candidate Lance revision. Project CI on this PR validates the integration with the official Lance `v16.0.0-beta.6`. Uses the official Lance dependency from #5327, now merged into `main`.
This commit is contained in:
@@ -173,6 +173,11 @@ impl Query {
|
||||
self.inner = self.inner.clone().use_rte(enable);
|
||||
}
|
||||
|
||||
#[napi]
|
||||
pub fn ordered_results(&mut self, ordered: bool) {
|
||||
self.inner = self.inner.clone().ordered_results(ordered);
|
||||
}
|
||||
|
||||
#[napi]
|
||||
pub fn order_by(&mut self, ordering: Option<Vec<ColumnOrdering>>) -> napi::Result<()> {
|
||||
let ordering = ordering.map(|ordering| {
|
||||
@@ -411,6 +416,11 @@ impl VectorQuery {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[napi]
|
||||
pub fn ordered_results(&mut self, ordered: bool) {
|
||||
self.inner = self.inner.clone().ordered_results(ordered);
|
||||
}
|
||||
|
||||
#[napi]
|
||||
pub fn order_by(&mut self, ordering: Option<Vec<ColumnOrdering>>) -> napi::Result<()> {
|
||||
let ordering = ordering.map(|ordering| {
|
||||
|
||||
Reference in New Issue
Block a user