@infino-ai/infino 0.11.30 → 0.11.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/infino/index.d.ts CHANGED
@@ -230,6 +230,26 @@ export interface Bm25SearchOptions {
230
230
  b?: number;
231
231
  arrow?: boolean;
232
232
  }
233
+ /** One clause of `bm25SearchFields`: a query text and the full-text columns
234
+ * it searches. The text is read as `bm25Search` reads a query, tokenized by
235
+ * each column's own analyzer. */
236
+ export interface FieldClause {
237
+ query: string;
238
+ fields: string[];
239
+ }
240
+ /** Options for `bm25SearchFields`. */
241
+ export interface Bm25FieldsOptions {
242
+ /** `"or"` (default): a row matching any clause is a hit; `"and"`: it must
243
+ * match every clause. Also the mode of each clause's bare terms. */
244
+ mode?: BoolMode;
245
+ /** What each named column's scores are multiplied by before a clause takes
246
+ * its best column; 1 for a column not named. Each must be finite and > 0;
247
+ * a weight on a column no clause searches has no effect. */
248
+ weights?: Record<string, number>;
249
+ /** Columns to return, e.g. `["_id", "body"]`; omit for `_id` + `score` only. */
250
+ projection?: string[];
251
+ arrow?: boolean;
252
+ }
233
253
  /** Text-predicate filter for `vectorSearch` (a pushdown pre-filter, not a
234
254
  * post-filter): kNN ranks only among rows whose FTS-indexed `column` matches
235
255
  * `query`. */
@@ -304,6 +324,15 @@ export declare class Table {
304
324
  arrow: true;
305
325
  }): arrow.Table;
306
326
  bm25Search(column: string, query: string, k: number, opts?: Bm25SearchOptions): RowRecord[];
327
+ /** Ranked BM25 over several full-text columns, scored *best fields*: each
328
+ * clause scores a row by its best column (the largest `weight × BM25` among
329
+ * its `fields`), and a row's score is the sum over the clauses it matches,
330
+ * as a multi-field `query_string` or `multi_match` of type `best_fields`
331
+ * ranks. Rows best first, ties by ascending `_id`. */
332
+ bm25SearchFields(clauses: FieldClause[], k: number, opts: Bm25FieldsOptions & {
333
+ arrow: true;
334
+ }): arrow.Table;
335
+ bm25SearchFields(clauses: FieldClause[], k: number, opts?: Bm25FieldsOptions): RowRecord[];
307
336
  /** Vector kNN; rows as records (or an Arrow `Table`). `score` is a distance
308
337
  * (`0.0` = perfect match) — opposite direction from `bm25Search`'s
309
338
  * similarity. Fuse with `hybridSearch`. */
package/infino/index.js CHANGED
@@ -310,6 +310,10 @@ class Table {
310
310
  const buf = guard(this.remote, () => this.inner.bm25Search(column, query, k, opts.mode, opts.projection, opts.k1, opts.b));
311
311
  return decode(buf, opts.arrow);
312
312
  }
313
+ bm25SearchFields(clauses, k, opts = {}) {
314
+ const buf = guard(this.remote, () => this.inner.bm25SearchFields(clauses, k, opts.mode, opts.weights, opts.projection));
315
+ return decode(buf, opts.arrow);
316
+ }
313
317
  vectorSearch(column, query, k, opts = {}) {
314
318
  const q = query instanceof Float32Array ? query : Float32Array.from(query);
315
319
  const buf = guard(this.remote, () => this.inner.vectorSearch(column, q, k, opts.projection, opts.filter));
@@ -67,6 +67,16 @@ export interface OptimizeOptions {
67
67
  */
68
68
  recalibrate?: string
69
69
  }
70
+ /**
71
+ * One clause of `bm25SearchFields`: a query text and the full-text columns
72
+ * it searches.
73
+ */
74
+ export interface FieldClause {
75
+ /** The clause's query text, read as `bm25Search` reads a query. */
76
+ query: string
77
+ /** The full-text columns the clause searches. */
78
+ fields: Array<string>
79
+ }
70
80
  /** Row counts from an `update` / `delete`. */
71
81
  export interface MutationStats {
72
82
  /** Rows the predicate matched. */
@@ -377,6 +387,20 @@ export declare class Table {
377
387
  * bounds are built with it and the correction disappears.
378
388
  */
379
389
  bm25Search(column: string, query: string, k: number, mode?: string | undefined | null, projection?: Array<string> | undefined | null, k1?: number | undefined | null, b?: number | undefined | null): Buffer
390
+ /**
391
+ * BM25 over several full-text columns at once, scored *best fields*.
392
+ * Each clause scores a row by its best column (the largest
393
+ * `weight × BM25` among the clause's `fields`), and the row's score is
394
+ * the sum over the clauses it matches: one `dis_max` (tie breaker 0)
395
+ * per clause, summed, as a multi-field `query_string` or `multi_match`
396
+ * of type `best_fields` ranks. `mode` is `"or"` (default: a row
397
+ * matching any clause is a hit) or `"and"` (it must match every
398
+ * clause), and is also the mode of each clause's bare terms.
399
+ * `weights` multiplies each named column's scores (1 for a column it
400
+ * does not name). Returns rows like `bm25Search`, best first, ties by
401
+ * ascending `_id`.
402
+ */
403
+ bm25SearchFields(clauses: Array<FieldClause>, k: number, mode?: string | undefined | null, weights?: Record<string, number> | undefined | null, projection?: Array<string> | undefined | null): Buffer
380
404
  /**
381
405
  * Vector kNN over one vector column. `query` is a `Float32Array`
382
406
  * (crosses by reference — no copy). Returns matching rows as an Arrow
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infino-ai/infino",
3
- "version": "0.11.30",
3
+ "version": "0.11.32",
4
4
  "description": "Fast search on object storage — SQL, full-text, and vector search.",
5
5
  "license": "Apache-2.0",
6
6
  "publishConfig": {
@@ -82,12 +82,12 @@
82
82
  "apache-arrow": "^17"
83
83
  },
84
84
  "optionalDependencies": {
85
- "infx-darwin-x64": "0.11.30",
86
- "infx-darwin-arm64": "0.11.30",
87
- "infx-linux-x64-gnu": "0.11.30",
88
- "infx-linux-arm64-gnu": "0.11.30",
89
- "infx-linux-x64-musl": "0.11.30",
90
- "infx-linux-arm64-musl": "0.11.30"
85
+ "infx-darwin-x64": "0.11.32",
86
+ "infx-darwin-arm64": "0.11.32",
87
+ "infx-linux-x64-gnu": "0.11.32",
88
+ "infx-linux-arm64-gnu": "0.11.32",
89
+ "infx-linux-x64-musl": "0.11.32",
90
+ "infx-linux-arm64-musl": "0.11.32"
91
91
  },
92
92
  "devDependencies": {
93
93
  "@napi-rs/cli": "^2.18.0",