@lancedb/lancedb 0.20.1-beta.1 → 0.21.0
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/dist/arrow.js +18 -2
- package/dist/native.d.ts +1 -1
- package/dist/query.d.ts +5 -1
- package/dist/query.js +5 -2
- package/package.json +9 -9
package/dist/arrow.js
CHANGED
|
@@ -682,8 +682,14 @@ async function applyEmbeddingsFromMetadata(table, schema) {
|
|
|
682
682
|
if (sourceColumn === undefined) {
|
|
683
683
|
throw new Error(`Cannot apply embedding function because the source column '${functionEntry.sourceColumn}' was not present in the data`);
|
|
684
684
|
}
|
|
685
|
+
// Check if destination column exists and handle accordingly
|
|
685
686
|
if (columns[destColumn] !== undefined) {
|
|
686
|
-
|
|
687
|
+
const existingColumn = columns[destColumn];
|
|
688
|
+
// If the column exists but is all null, we can fill it with embeddings
|
|
689
|
+
if (existingColumn.nullCount !== existingColumn.length) {
|
|
690
|
+
// Column has non-null values, skip embedding application
|
|
691
|
+
continue;
|
|
692
|
+
}
|
|
687
693
|
}
|
|
688
694
|
if (table.batches.length > 1) {
|
|
689
695
|
throw new Error("Internal error: `makeArrowTable` unexpectedly created a table with more than one batch");
|
|
@@ -765,8 +771,18 @@ async function applyEmbeddings(table, embeddings, schema) {
|
|
|
765
771
|
}
|
|
766
772
|
}
|
|
767
773
|
else {
|
|
774
|
+
// Check if destination column exists and handle accordingly
|
|
768
775
|
if (Object.prototype.hasOwnProperty.call(newColumns, destColumn)) {
|
|
769
|
-
|
|
776
|
+
const existingColumn = newColumns[destColumn];
|
|
777
|
+
// If the column exists but is all null, we can fill it with embeddings
|
|
778
|
+
if (existingColumn.nullCount !== existingColumn.length) {
|
|
779
|
+
// Column has non-null values, skip embedding application and return table as-is
|
|
780
|
+
let newTable = new apache_arrow_1.Table(newColumns);
|
|
781
|
+
if (schema != null) {
|
|
782
|
+
newTable = alignTable(newTable, schema);
|
|
783
|
+
}
|
|
784
|
+
return new apache_arrow_1.Table(new apache_arrow_1.Schema(newTable.schema.fields, schemaMetadata), newTable.batches);
|
|
785
|
+
}
|
|
770
786
|
}
|
|
771
787
|
if (table.batches.length > 1) {
|
|
772
788
|
throw new Error("Internal error: `makeArrowTable` unexpectedly created a table with more than one batch");
|
package/dist/native.d.ts
CHANGED
|
@@ -381,7 +381,7 @@ export class VectorQuery {
|
|
|
381
381
|
analyzePlan(): Promise<string>
|
|
382
382
|
}
|
|
383
383
|
export class JsFullTextQuery {
|
|
384
|
-
static matchQuery(query: string, column: string, boost: number, fuzziness: number | undefined | null, maxExpansions: number, operator: string): JsFullTextQuery
|
|
384
|
+
static matchQuery(query: string, column: string, boost: number, fuzziness: number | undefined | null, maxExpansions: number, operator: string, prefixLength: number): JsFullTextQuery
|
|
385
385
|
static phraseQuery(query: string, column: string, slop: number): JsFullTextQuery
|
|
386
386
|
static boostQuery(positive: JsFullTextQuery, negative: JsFullTextQuery, negativeBoost?: number | undefined | null): JsFullTextQuery
|
|
387
387
|
static multiMatchQuery(query: string, columns: Array<string>, boosts: Array<number> | undefined | null, operator: string): JsFullTextQuery
|
package/dist/query.d.ts
CHANGED
|
@@ -445,10 +445,12 @@ export declare enum Operator {
|
|
|
445
445
|
*
|
|
446
446
|
* - `Must`: The term must be present in the document.
|
|
447
447
|
* - `Should`: The term should contribute to the document score, but is not required.
|
|
448
|
+
* - `MustNot`: The term must not be present in the document.
|
|
448
449
|
*/
|
|
449
450
|
export declare enum Occur {
|
|
451
|
+
Should = "SHOULD",
|
|
450
452
|
Must = "MUST",
|
|
451
|
-
|
|
453
|
+
MustNot = "MUST_NOT"
|
|
452
454
|
}
|
|
453
455
|
/**
|
|
454
456
|
* Represents a full-text query interface.
|
|
@@ -481,12 +483,14 @@ export declare class MatchQuery implements FullTextQuery {
|
|
|
481
483
|
* - `fuzziness`: The fuzziness level for the query (default is 0).
|
|
482
484
|
* - `maxExpansions`: The maximum number of terms to consider for fuzzy matching (default is 50).
|
|
483
485
|
* - `operator`: The logical operator to use for combining terms in the query (default is "OR").
|
|
486
|
+
* - `prefixLength`: The number of beginning characters being unchanged for fuzzy matching.
|
|
484
487
|
*/
|
|
485
488
|
constructor(query: string, column: string, options?: {
|
|
486
489
|
boost?: number;
|
|
487
490
|
fuzziness?: number;
|
|
488
491
|
maxExpansions?: number;
|
|
489
492
|
operator?: Operator;
|
|
493
|
+
prefixLength?: number;
|
|
490
494
|
});
|
|
491
495
|
queryType(): FullTextQueryType;
|
|
492
496
|
}
|
package/dist/query.js
CHANGED
|
@@ -708,11 +708,13 @@ var Operator;
|
|
|
708
708
|
*
|
|
709
709
|
* - `Must`: The term must be present in the document.
|
|
710
710
|
* - `Should`: The term should contribute to the document score, but is not required.
|
|
711
|
+
* - `MustNot`: The term must not be present in the document.
|
|
711
712
|
*/
|
|
712
713
|
var Occur;
|
|
713
714
|
(function (Occur) {
|
|
714
|
-
Occur["Must"] = "MUST";
|
|
715
715
|
Occur["Should"] = "SHOULD";
|
|
716
|
+
Occur["Must"] = "MUST";
|
|
717
|
+
Occur["MustNot"] = "MUST_NOT";
|
|
716
718
|
})(Occur || (exports.Occur = Occur = {}));
|
|
717
719
|
// biome-ignore lint/suspicious/noExplicitAny: we want any here
|
|
718
720
|
function instanceOfFullTextQuery(obj) {
|
|
@@ -731,13 +733,14 @@ class MatchQuery {
|
|
|
731
733
|
* - `fuzziness`: The fuzziness level for the query (default is 0).
|
|
732
734
|
* - `maxExpansions`: The maximum number of terms to consider for fuzzy matching (default is 50).
|
|
733
735
|
* - `operator`: The logical operator to use for combining terms in the query (default is "OR").
|
|
736
|
+
* - `prefixLength`: The number of beginning characters being unchanged for fuzzy matching.
|
|
734
737
|
*/
|
|
735
738
|
constructor(query, column, options) {
|
|
736
739
|
let fuzziness = options?.fuzziness;
|
|
737
740
|
if (fuzziness === undefined) {
|
|
738
741
|
fuzziness = 0;
|
|
739
742
|
}
|
|
740
|
-
this.inner = native_1.JsFullTextQuery.matchQuery(query, column, options?.boost ?? 1.0, fuzziness, options?.maxExpansions ?? 50, options?.operator ?? Operator.Or);
|
|
743
|
+
this.inner = native_1.JsFullTextQuery.matchQuery(query, column, options?.boost ?? 1.0, fuzziness, options?.maxExpansions ?? 50, options?.operator ?? Operator.Or, options?.prefixLength ?? 0);
|
|
741
744
|
}
|
|
742
745
|
queryType() {
|
|
743
746
|
return FullTextQueryType.Match;
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"ann"
|
|
12
12
|
],
|
|
13
13
|
"private": false,
|
|
14
|
-
"version": "0.
|
|
14
|
+
"version": "0.21.0",
|
|
15
15
|
"main": "dist/index.js",
|
|
16
16
|
"exports": {
|
|
17
17
|
".": "./dist/index.js",
|
|
@@ -100,14 +100,14 @@
|
|
|
100
100
|
"reflect-metadata": "^0.2.2"
|
|
101
101
|
},
|
|
102
102
|
"optionalDependencies": {
|
|
103
|
-
"@lancedb/lancedb-darwin-x64": "0.
|
|
104
|
-
"@lancedb/lancedb-darwin-arm64": "0.
|
|
105
|
-
"@lancedb/lancedb-linux-x64-gnu": "0.
|
|
106
|
-
"@lancedb/lancedb-linux-arm64-gnu": "0.
|
|
107
|
-
"@lancedb/lancedb-linux-x64-musl": "0.
|
|
108
|
-
"@lancedb/lancedb-linux-arm64-musl": "0.
|
|
109
|
-
"@lancedb/lancedb-win32-x64-msvc": "0.
|
|
110
|
-
"@lancedb/lancedb-win32-arm64-msvc": "0.
|
|
103
|
+
"@lancedb/lancedb-darwin-x64": "0.21.0",
|
|
104
|
+
"@lancedb/lancedb-darwin-arm64": "0.21.0",
|
|
105
|
+
"@lancedb/lancedb-linux-x64-gnu": "0.21.0",
|
|
106
|
+
"@lancedb/lancedb-linux-arm64-gnu": "0.21.0",
|
|
107
|
+
"@lancedb/lancedb-linux-x64-musl": "0.21.0",
|
|
108
|
+
"@lancedb/lancedb-linux-arm64-musl": "0.21.0",
|
|
109
|
+
"@lancedb/lancedb-win32-x64-msvc": "0.21.0",
|
|
110
|
+
"@lancedb/lancedb-win32-arm64-msvc": "0.21.0"
|
|
111
111
|
},
|
|
112
112
|
"peerDependencies": {
|
|
113
113
|
"apache-arrow": ">=15.0.0 <=18.1.0"
|