hyperspace-sdk-ts 3.0.10 → 3.1.1
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/README.md +22 -1
- package/dist/client.d.ts +14 -2
- package/dist/client.js +46 -2
- package/dist/proto/hyperspace_pb.js +610 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# HyperspaceDB TypeScript SDK
|
|
2
2
|
|
|
3
|
-
Official TypeScript client for HyperspaceDB gRPC API
|
|
3
|
+
Official TypeScript client for HyperspaceDB gRPC API v3.1.0.
|
|
4
4
|
|
|
5
5
|
Use this SDK for:
|
|
6
6
|
- collection lifecycle management
|
|
@@ -147,6 +147,27 @@ const results = await client.search([0.1, 0.2, 0.3], 10, "coll", {
|
|
|
147
147
|
});
|
|
148
148
|
```
|
|
149
149
|
|
|
150
|
+
### Hybrid & Lexical Search (BM25)
|
|
151
|
+
|
|
152
|
+
HyperspaceDB supports combined lexical and vector ranking.
|
|
153
|
+
|
|
154
|
+
```ts
|
|
155
|
+
// Hybrid Search (Semantic Vector + BM25 Lexical)
|
|
156
|
+
const results = await client.search([0.1, -0.2, 0.5], 10, "coll", {
|
|
157
|
+
hybridQuery: "hybrid search implementation",
|
|
158
|
+
hybridAlpha: 0.7, // 70% vector weight
|
|
159
|
+
bm25: {
|
|
160
|
+
method: "bm25plus",
|
|
161
|
+
language: "english"
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
// Or Pure Lexical Search via searchText
|
|
166
|
+
const lexicalResults = await client.searchText("full-text query", 10, "coll", {
|
|
167
|
+
bm25: { method: "lucene" }
|
|
168
|
+
});
|
|
169
|
+
```
|
|
170
|
+
|
|
150
171
|
### `searchBatch(vectors, topK, collection?)`
|
|
151
172
|
|
|
152
173
|
Run multiple searches in one gRPC request to reduce RPC overhead.
|
package/dist/client.d.ts
CHANGED
|
@@ -48,6 +48,15 @@ export interface VacuumFilter {
|
|
|
48
48
|
op: 'lt' | 'lte' | 'gt' | 'gte' | 'eq' | 'ne';
|
|
49
49
|
value: number;
|
|
50
50
|
}
|
|
51
|
+
export interface Bm25Options {
|
|
52
|
+
method?: "bm25plus" | "bm25l" | "robertson" | "lucene" | "atire";
|
|
53
|
+
k1?: number;
|
|
54
|
+
b?: number;
|
|
55
|
+
delta?: number;
|
|
56
|
+
language?: string;
|
|
57
|
+
ngrams?: number;
|
|
58
|
+
fusionMethod?: "rrf" | "weighted";
|
|
59
|
+
}
|
|
51
60
|
export type EventTypeName = 'insert' | 'delete';
|
|
52
61
|
export interface SubscribeOptions {
|
|
53
62
|
types?: EventTypeName[];
|
|
@@ -77,12 +86,12 @@ export declare class HyperspaceClient {
|
|
|
77
86
|
deleteCollection(name: string): Promise<boolean>;
|
|
78
87
|
listCollections(): Promise<CollectionInfo[]>;
|
|
79
88
|
delete(id: number, collection?: string): Promise<boolean>;
|
|
80
|
-
insert(vector: number[] | Float32Array | Float64Array,
|
|
89
|
+
insert(id: number, vector: number[] | Float32Array | Float64Array, meta?: {
|
|
81
90
|
[key: string]: string;
|
|
82
91
|
}, collection?: string, durability?: DurabilityLevel, typedMetadata?: {
|
|
83
92
|
[key: string]: TypedMetadataValue;
|
|
84
93
|
}): Promise<boolean>;
|
|
85
|
-
insertText(
|
|
94
|
+
insertText(id: number, text: string, meta?: {
|
|
86
95
|
[key: string]: string;
|
|
87
96
|
}, collection?: string, durability?: DurabilityLevel): Promise<boolean>;
|
|
88
97
|
vectorize(text: string, metric?: string): Promise<number[]>;
|
|
@@ -100,9 +109,12 @@ export declare class HyperspaceClient {
|
|
|
100
109
|
filters?: Filter[];
|
|
101
110
|
hybridQuery?: string;
|
|
102
111
|
hybridAlpha?: number;
|
|
112
|
+
bm25?: Bm25Options;
|
|
103
113
|
}): Promise<SearchResult[]>;
|
|
104
114
|
searchText(text: string, topK: number, collection?: string, options?: {
|
|
105
115
|
filters?: Filter[];
|
|
116
|
+
bm25?: Bm25Options;
|
|
117
|
+
hybridAlpha?: number;
|
|
106
118
|
}): Promise<SearchResult[]>;
|
|
107
119
|
searchBatch(vectors: Array<number[] | Float32Array | Float64Array>, topK: number, collection?: string): Promise<SearchResult[][]>;
|
|
108
120
|
getDigest(collection?: string): Promise<{
|
package/dist/client.js
CHANGED
|
@@ -296,7 +296,7 @@ class HyperspaceClient {
|
|
|
296
296
|
});
|
|
297
297
|
});
|
|
298
298
|
}
|
|
299
|
-
insert(
|
|
299
|
+
insert(id, vector, meta, collection = '', durability = hyperspace_pb_1.DurabilityLevel.DEFAULT_LEVEL, typedMetadata) {
|
|
300
300
|
return new Promise((resolve, reject) => {
|
|
301
301
|
const req = new hyperspace_pb_1.InsertRequest();
|
|
302
302
|
req.setVectorList(HyperspaceClient.toVectorList(vector));
|
|
@@ -322,7 +322,7 @@ class HyperspaceClient {
|
|
|
322
322
|
});
|
|
323
323
|
});
|
|
324
324
|
}
|
|
325
|
-
insertText(
|
|
325
|
+
insertText(id, text, meta, collection = '', durability = hyperspace_pb_1.DurabilityLevel.DEFAULT_LEVEL) {
|
|
326
326
|
return new Promise((resolve, reject) => {
|
|
327
327
|
const req = new hyperspace_pb_1.InsertTextRequest();
|
|
328
328
|
req.setText(text);
|
|
@@ -422,6 +422,26 @@ class HyperspaceClient {
|
|
|
422
422
|
req.setHybridQuery(options.hybridQuery);
|
|
423
423
|
if ((options === null || options === void 0 ? void 0 : options.hybridAlpha) !== undefined)
|
|
424
424
|
req.setHybridAlpha(options.hybridAlpha);
|
|
425
|
+
if (options === null || options === void 0 ? void 0 : options.bm25) {
|
|
426
|
+
// @ts-ignore: Bm25Options might not be in generated proto yet
|
|
427
|
+
const bm25Msg = new hyperspace_pb.Bm25Options();
|
|
428
|
+
if (options.bm25.method !== undefined)
|
|
429
|
+
bm25Msg.setMethod(options.bm25.method);
|
|
430
|
+
if (options.bm25.k1 !== undefined)
|
|
431
|
+
bm25Msg.setK1(options.bm25.k1);
|
|
432
|
+
if (options.bm25.b !== undefined)
|
|
433
|
+
bm25Msg.setB(options.bm25.b);
|
|
434
|
+
if (options.bm25.delta !== undefined)
|
|
435
|
+
bm25Msg.setDelta(options.bm25.delta);
|
|
436
|
+
if (options.bm25.language !== undefined)
|
|
437
|
+
bm25Msg.setLanguage(options.bm25.language);
|
|
438
|
+
if (options.bm25.ngrams !== undefined)
|
|
439
|
+
bm25Msg.setNgrams(options.bm25.ngrams);
|
|
440
|
+
if (options.bm25.fusionMethod !== undefined)
|
|
441
|
+
bm25Msg.setFusionMethod(options.bm25.fusionMethod);
|
|
442
|
+
// @ts-ignore
|
|
443
|
+
req.setBm25Options(bm25Msg);
|
|
444
|
+
}
|
|
425
445
|
this.client.search(req, this.metadata, (err, resp) => {
|
|
426
446
|
if (err)
|
|
427
447
|
return reject(err);
|
|
@@ -480,6 +500,30 @@ class HyperspaceClient {
|
|
|
480
500
|
});
|
|
481
501
|
req.setFiltersList(protoFilters);
|
|
482
502
|
}
|
|
503
|
+
if (options === null || options === void 0 ? void 0 : options.bm25) {
|
|
504
|
+
// @ts-ignore
|
|
505
|
+
const bm25Msg = new hyperspace_pb.Bm25Options();
|
|
506
|
+
if (options.bm25.method !== undefined)
|
|
507
|
+
bm25Msg.setMethod(options.bm25.method);
|
|
508
|
+
if (options.bm25.k1 !== undefined)
|
|
509
|
+
bm25Msg.setK1(options.bm25.k1);
|
|
510
|
+
if (options.bm25.b !== undefined)
|
|
511
|
+
bm25Msg.setB(options.bm25.b);
|
|
512
|
+
if (options.bm25.delta !== undefined)
|
|
513
|
+
bm25Msg.setDelta(options.bm25.delta);
|
|
514
|
+
if (options.bm25.language !== undefined)
|
|
515
|
+
bm25Msg.setLanguage(options.bm25.language);
|
|
516
|
+
if (options.bm25.ngrams !== undefined)
|
|
517
|
+
bm25Msg.setNgrams(options.bm25.ngrams);
|
|
518
|
+
if (options.bm25.fusionMethod !== undefined)
|
|
519
|
+
bm25Msg.setFusionMethod(options.bm25.fusionMethod);
|
|
520
|
+
// @ts-ignore
|
|
521
|
+
req.setBm25Options(bm25Msg);
|
|
522
|
+
}
|
|
523
|
+
if ((options === null || options === void 0 ? void 0 : options.hybridAlpha) !== undefined) {
|
|
524
|
+
// @ts-ignore
|
|
525
|
+
req.setHybridAlpha(options.hybridAlpha);
|
|
526
|
+
}
|
|
483
527
|
this.client.searchText(req, this.metadata, (err, resp) => {
|
|
484
528
|
if (err)
|
|
485
529
|
return reject(err);
|
|
@@ -24,6 +24,7 @@ var global = (function() {
|
|
|
24
24
|
goog.exportSymbol('proto.hyperspace.BatchInsertRequest', null, global);
|
|
25
25
|
goog.exportSymbol('proto.hyperspace.BatchSearchRequest', null, global);
|
|
26
26
|
goog.exportSymbol('proto.hyperspace.BatchSearchResponse', null, global);
|
|
27
|
+
goog.exportSymbol('proto.hyperspace.Bm25Options', null, global);
|
|
27
28
|
goog.exportSymbol('proto.hyperspace.CollectionStatsRequest', null, global);
|
|
28
29
|
goog.exportSymbol('proto.hyperspace.CollectionStatsResponse', null, global);
|
|
29
30
|
goog.exportSymbol('proto.hyperspace.CollectionSummary', null, global);
|
|
@@ -600,6 +601,27 @@ if (goog.DEBUG && !COMPILED) {
|
|
|
600
601
|
*/
|
|
601
602
|
proto.hyperspace.SearchTextRequest.displayName = 'proto.hyperspace.SearchTextRequest';
|
|
602
603
|
}
|
|
604
|
+
/**
|
|
605
|
+
* Generated by JsPbCodeGenerator.
|
|
606
|
+
* @param {Array=} opt_data Optional initial data array, typically from a
|
|
607
|
+
* server response, or constructed directly in Javascript. The array is used
|
|
608
|
+
* in place and becomes part of the constructed object. It is not cloned.
|
|
609
|
+
* If no data is provided, the constructed object will be empty, but still
|
|
610
|
+
* valid.
|
|
611
|
+
* @extends {jspb.Message}
|
|
612
|
+
* @constructor
|
|
613
|
+
*/
|
|
614
|
+
proto.hyperspace.Bm25Options = function(opt_data) {
|
|
615
|
+
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
|
|
616
|
+
};
|
|
617
|
+
goog.inherits(proto.hyperspace.Bm25Options, jspb.Message);
|
|
618
|
+
if (goog.DEBUG && !COMPILED) {
|
|
619
|
+
/**
|
|
620
|
+
* @public
|
|
621
|
+
* @override
|
|
622
|
+
*/
|
|
623
|
+
proto.hyperspace.Bm25Options.displayName = 'proto.hyperspace.Bm25Options';
|
|
624
|
+
}
|
|
603
625
|
/**
|
|
604
626
|
* Generated by JsPbCodeGenerator.
|
|
605
627
|
* @param {Array=} opt_data Optional initial data array, typically from a
|
|
@@ -6239,7 +6261,9 @@ proto.hyperspace.SearchTextRequest.toObject = function(includeInstance, msg) {
|
|
|
6239
6261
|
topK: jspb.Message.getFieldWithDefault(msg, 3, 0),
|
|
6240
6262
|
filterMap: (f = msg.getFilterMap()) ? f.toObject(includeInstance, undefined) : [],
|
|
6241
6263
|
filtersList: jspb.Message.toObjectList(msg.getFiltersList(),
|
|
6242
|
-
proto.hyperspace.Filter.toObject, includeInstance)
|
|
6264
|
+
proto.hyperspace.Filter.toObject, includeInstance),
|
|
6265
|
+
bm25Options: (f = msg.getBm25Options()) && proto.hyperspace.Bm25Options.toObject(includeInstance, f),
|
|
6266
|
+
hybridAlpha: jspb.Message.getFloatingPointFieldWithDefault(msg, 7, 0.0)
|
|
6243
6267
|
};
|
|
6244
6268
|
|
|
6245
6269
|
if (includeInstance) {
|
|
@@ -6299,6 +6323,15 @@ proto.hyperspace.SearchTextRequest.deserializeBinaryFromReader = function(msg, r
|
|
|
6299
6323
|
reader.readMessage(value,proto.hyperspace.Filter.deserializeBinaryFromReader);
|
|
6300
6324
|
msg.addFilters(value);
|
|
6301
6325
|
break;
|
|
6326
|
+
case 6:
|
|
6327
|
+
var value = new proto.hyperspace.Bm25Options;
|
|
6328
|
+
reader.readMessage(value,proto.hyperspace.Bm25Options.deserializeBinaryFromReader);
|
|
6329
|
+
msg.setBm25Options(value);
|
|
6330
|
+
break;
|
|
6331
|
+
case 7:
|
|
6332
|
+
var value = /** @type {number} */ (reader.readFloat());
|
|
6333
|
+
msg.setHybridAlpha(value);
|
|
6334
|
+
break;
|
|
6302
6335
|
default:
|
|
6303
6336
|
reader.skipField();
|
|
6304
6337
|
break;
|
|
@@ -6361,6 +6394,21 @@ proto.hyperspace.SearchTextRequest.serializeBinaryToWriter = function(message, w
|
|
|
6361
6394
|
proto.hyperspace.Filter.serializeBinaryToWriter
|
|
6362
6395
|
);
|
|
6363
6396
|
}
|
|
6397
|
+
f = message.getBm25Options();
|
|
6398
|
+
if (f != null) {
|
|
6399
|
+
writer.writeMessage(
|
|
6400
|
+
6,
|
|
6401
|
+
f,
|
|
6402
|
+
proto.hyperspace.Bm25Options.serializeBinaryToWriter
|
|
6403
|
+
);
|
|
6404
|
+
}
|
|
6405
|
+
f = /** @type {number} */ (jspb.Message.getField(message, 7));
|
|
6406
|
+
if (f != null) {
|
|
6407
|
+
writer.writeFloat(
|
|
6408
|
+
7,
|
|
6409
|
+
f
|
|
6410
|
+
);
|
|
6411
|
+
}
|
|
6364
6412
|
};
|
|
6365
6413
|
|
|
6366
6414
|
|
|
@@ -6478,6 +6526,515 @@ proto.hyperspace.SearchTextRequest.prototype.clearFiltersList = function() {
|
|
|
6478
6526
|
};
|
|
6479
6527
|
|
|
6480
6528
|
|
|
6529
|
+
/**
|
|
6530
|
+
* optional Bm25Options bm25_options = 6;
|
|
6531
|
+
* @return {?proto.hyperspace.Bm25Options}
|
|
6532
|
+
*/
|
|
6533
|
+
proto.hyperspace.SearchTextRequest.prototype.getBm25Options = function() {
|
|
6534
|
+
return /** @type{?proto.hyperspace.Bm25Options} */ (
|
|
6535
|
+
jspb.Message.getWrapperField(this, proto.hyperspace.Bm25Options, 6));
|
|
6536
|
+
};
|
|
6537
|
+
|
|
6538
|
+
|
|
6539
|
+
/**
|
|
6540
|
+
* @param {?proto.hyperspace.Bm25Options|undefined} value
|
|
6541
|
+
* @return {!proto.hyperspace.SearchTextRequest} returns this
|
|
6542
|
+
*/
|
|
6543
|
+
proto.hyperspace.SearchTextRequest.prototype.setBm25Options = function(value) {
|
|
6544
|
+
return jspb.Message.setWrapperField(this, 6, value);
|
|
6545
|
+
};
|
|
6546
|
+
|
|
6547
|
+
|
|
6548
|
+
/**
|
|
6549
|
+
* Clears the message field making it undefined.
|
|
6550
|
+
* @return {!proto.hyperspace.SearchTextRequest} returns this
|
|
6551
|
+
*/
|
|
6552
|
+
proto.hyperspace.SearchTextRequest.prototype.clearBm25Options = function() {
|
|
6553
|
+
return this.setBm25Options(undefined);
|
|
6554
|
+
};
|
|
6555
|
+
|
|
6556
|
+
|
|
6557
|
+
/**
|
|
6558
|
+
* Returns whether this field is set.
|
|
6559
|
+
* @return {boolean}
|
|
6560
|
+
*/
|
|
6561
|
+
proto.hyperspace.SearchTextRequest.prototype.hasBm25Options = function() {
|
|
6562
|
+
return jspb.Message.getField(this, 6) != null;
|
|
6563
|
+
};
|
|
6564
|
+
|
|
6565
|
+
|
|
6566
|
+
/**
|
|
6567
|
+
* optional float hybrid_alpha = 7;
|
|
6568
|
+
* @return {number}
|
|
6569
|
+
*/
|
|
6570
|
+
proto.hyperspace.SearchTextRequest.prototype.getHybridAlpha = function() {
|
|
6571
|
+
return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 7, 0.0));
|
|
6572
|
+
};
|
|
6573
|
+
|
|
6574
|
+
|
|
6575
|
+
/**
|
|
6576
|
+
* @param {number} value
|
|
6577
|
+
* @return {!proto.hyperspace.SearchTextRequest} returns this
|
|
6578
|
+
*/
|
|
6579
|
+
proto.hyperspace.SearchTextRequest.prototype.setHybridAlpha = function(value) {
|
|
6580
|
+
return jspb.Message.setField(this, 7, value);
|
|
6581
|
+
};
|
|
6582
|
+
|
|
6583
|
+
|
|
6584
|
+
/**
|
|
6585
|
+
* Clears the field making it undefined.
|
|
6586
|
+
* @return {!proto.hyperspace.SearchTextRequest} returns this
|
|
6587
|
+
*/
|
|
6588
|
+
proto.hyperspace.SearchTextRequest.prototype.clearHybridAlpha = function() {
|
|
6589
|
+
return jspb.Message.setField(this, 7, undefined);
|
|
6590
|
+
};
|
|
6591
|
+
|
|
6592
|
+
|
|
6593
|
+
/**
|
|
6594
|
+
* Returns whether this field is set.
|
|
6595
|
+
* @return {boolean}
|
|
6596
|
+
*/
|
|
6597
|
+
proto.hyperspace.SearchTextRequest.prototype.hasHybridAlpha = function() {
|
|
6598
|
+
return jspb.Message.getField(this, 7) != null;
|
|
6599
|
+
};
|
|
6600
|
+
|
|
6601
|
+
|
|
6602
|
+
|
|
6603
|
+
|
|
6604
|
+
|
|
6605
|
+
if (jspb.Message.GENERATE_TO_OBJECT) {
|
|
6606
|
+
/**
|
|
6607
|
+
* Creates an object representation of this proto.
|
|
6608
|
+
* Field names that are reserved in JavaScript and will be renamed to pb_name.
|
|
6609
|
+
* Optional fields that are not set will be set to undefined.
|
|
6610
|
+
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
|
|
6611
|
+
* For the list of reserved names please see:
|
|
6612
|
+
* net/proto2/compiler/js/internal/generator.cc#kKeyword.
|
|
6613
|
+
* @param {boolean=} opt_includeInstance Deprecated. whether to include the
|
|
6614
|
+
* JSPB instance for transitional soy proto support:
|
|
6615
|
+
* http://goto/soy-param-migration
|
|
6616
|
+
* @return {!Object}
|
|
6617
|
+
*/
|
|
6618
|
+
proto.hyperspace.Bm25Options.prototype.toObject = function(opt_includeInstance) {
|
|
6619
|
+
return proto.hyperspace.Bm25Options.toObject(opt_includeInstance, this);
|
|
6620
|
+
};
|
|
6621
|
+
|
|
6622
|
+
|
|
6623
|
+
/**
|
|
6624
|
+
* Static version of the {@see toObject} method.
|
|
6625
|
+
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
|
|
6626
|
+
* the JSPB instance for transitional soy proto support:
|
|
6627
|
+
* http://goto/soy-param-migration
|
|
6628
|
+
* @param {!proto.hyperspace.Bm25Options} msg The msg instance to transform.
|
|
6629
|
+
* @return {!Object}
|
|
6630
|
+
* @suppress {unusedLocalVariables} f is only used for nested messages
|
|
6631
|
+
*/
|
|
6632
|
+
proto.hyperspace.Bm25Options.toObject = function(includeInstance, msg) {
|
|
6633
|
+
var f, obj = {
|
|
6634
|
+
method: jspb.Message.getFieldWithDefault(msg, 1, ""),
|
|
6635
|
+
k1: jspb.Message.getFloatingPointFieldWithDefault(msg, 2, 0.0),
|
|
6636
|
+
b: jspb.Message.getFloatingPointFieldWithDefault(msg, 3, 0.0),
|
|
6637
|
+
delta: jspb.Message.getFloatingPointFieldWithDefault(msg, 4, 0.0),
|
|
6638
|
+
language: jspb.Message.getFieldWithDefault(msg, 5, ""),
|
|
6639
|
+
ngrams: jspb.Message.getFieldWithDefault(msg, 6, 0),
|
|
6640
|
+
fusionMethod: jspb.Message.getFieldWithDefault(msg, 7, "")
|
|
6641
|
+
};
|
|
6642
|
+
|
|
6643
|
+
if (includeInstance) {
|
|
6644
|
+
obj.$jspbMessageInstance = msg;
|
|
6645
|
+
}
|
|
6646
|
+
return obj;
|
|
6647
|
+
};
|
|
6648
|
+
}
|
|
6649
|
+
|
|
6650
|
+
|
|
6651
|
+
/**
|
|
6652
|
+
* Deserializes binary data (in protobuf wire format).
|
|
6653
|
+
* @param {jspb.ByteSource} bytes The bytes to deserialize.
|
|
6654
|
+
* @return {!proto.hyperspace.Bm25Options}
|
|
6655
|
+
*/
|
|
6656
|
+
proto.hyperspace.Bm25Options.deserializeBinary = function(bytes) {
|
|
6657
|
+
var reader = new jspb.BinaryReader(bytes);
|
|
6658
|
+
var msg = new proto.hyperspace.Bm25Options;
|
|
6659
|
+
return proto.hyperspace.Bm25Options.deserializeBinaryFromReader(msg, reader);
|
|
6660
|
+
};
|
|
6661
|
+
|
|
6662
|
+
|
|
6663
|
+
/**
|
|
6664
|
+
* Deserializes binary data (in protobuf wire format) from the
|
|
6665
|
+
* given reader into the given message object.
|
|
6666
|
+
* @param {!proto.hyperspace.Bm25Options} msg The message object to deserialize into.
|
|
6667
|
+
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
|
|
6668
|
+
* @return {!proto.hyperspace.Bm25Options}
|
|
6669
|
+
*/
|
|
6670
|
+
proto.hyperspace.Bm25Options.deserializeBinaryFromReader = function(msg, reader) {
|
|
6671
|
+
while (reader.nextField()) {
|
|
6672
|
+
if (reader.isEndGroup()) {
|
|
6673
|
+
break;
|
|
6674
|
+
}
|
|
6675
|
+
var field = reader.getFieldNumber();
|
|
6676
|
+
switch (field) {
|
|
6677
|
+
case 1:
|
|
6678
|
+
var value = /** @type {string} */ (reader.readString());
|
|
6679
|
+
msg.setMethod(value);
|
|
6680
|
+
break;
|
|
6681
|
+
case 2:
|
|
6682
|
+
var value = /** @type {number} */ (reader.readFloat());
|
|
6683
|
+
msg.setK1(value);
|
|
6684
|
+
break;
|
|
6685
|
+
case 3:
|
|
6686
|
+
var value = /** @type {number} */ (reader.readFloat());
|
|
6687
|
+
msg.setB(value);
|
|
6688
|
+
break;
|
|
6689
|
+
case 4:
|
|
6690
|
+
var value = /** @type {number} */ (reader.readFloat());
|
|
6691
|
+
msg.setDelta(value);
|
|
6692
|
+
break;
|
|
6693
|
+
case 5:
|
|
6694
|
+
var value = /** @type {string} */ (reader.readString());
|
|
6695
|
+
msg.setLanguage(value);
|
|
6696
|
+
break;
|
|
6697
|
+
case 6:
|
|
6698
|
+
var value = /** @type {number} */ (reader.readUint32());
|
|
6699
|
+
msg.setNgrams(value);
|
|
6700
|
+
break;
|
|
6701
|
+
case 7:
|
|
6702
|
+
var value = /** @type {string} */ (reader.readString());
|
|
6703
|
+
msg.setFusionMethod(value);
|
|
6704
|
+
break;
|
|
6705
|
+
default:
|
|
6706
|
+
reader.skipField();
|
|
6707
|
+
break;
|
|
6708
|
+
}
|
|
6709
|
+
}
|
|
6710
|
+
return msg;
|
|
6711
|
+
};
|
|
6712
|
+
|
|
6713
|
+
|
|
6714
|
+
/**
|
|
6715
|
+
* Serializes the message to binary data (in protobuf wire format).
|
|
6716
|
+
* @return {!Uint8Array}
|
|
6717
|
+
*/
|
|
6718
|
+
proto.hyperspace.Bm25Options.prototype.serializeBinary = function() {
|
|
6719
|
+
var writer = new jspb.BinaryWriter();
|
|
6720
|
+
proto.hyperspace.Bm25Options.serializeBinaryToWriter(this, writer);
|
|
6721
|
+
return writer.getResultBuffer();
|
|
6722
|
+
};
|
|
6723
|
+
|
|
6724
|
+
|
|
6725
|
+
/**
|
|
6726
|
+
* Serializes the given message to binary data (in protobuf wire
|
|
6727
|
+
* format), writing to the given BinaryWriter.
|
|
6728
|
+
* @param {!proto.hyperspace.Bm25Options} message
|
|
6729
|
+
* @param {!jspb.BinaryWriter} writer
|
|
6730
|
+
* @suppress {unusedLocalVariables} f is only used for nested messages
|
|
6731
|
+
*/
|
|
6732
|
+
proto.hyperspace.Bm25Options.serializeBinaryToWriter = function(message, writer) {
|
|
6733
|
+
var f = undefined;
|
|
6734
|
+
f = /** @type {string} */ (jspb.Message.getField(message, 1));
|
|
6735
|
+
if (f != null) {
|
|
6736
|
+
writer.writeString(
|
|
6737
|
+
1,
|
|
6738
|
+
f
|
|
6739
|
+
);
|
|
6740
|
+
}
|
|
6741
|
+
f = /** @type {number} */ (jspb.Message.getField(message, 2));
|
|
6742
|
+
if (f != null) {
|
|
6743
|
+
writer.writeFloat(
|
|
6744
|
+
2,
|
|
6745
|
+
f
|
|
6746
|
+
);
|
|
6747
|
+
}
|
|
6748
|
+
f = /** @type {number} */ (jspb.Message.getField(message, 3));
|
|
6749
|
+
if (f != null) {
|
|
6750
|
+
writer.writeFloat(
|
|
6751
|
+
3,
|
|
6752
|
+
f
|
|
6753
|
+
);
|
|
6754
|
+
}
|
|
6755
|
+
f = /** @type {number} */ (jspb.Message.getField(message, 4));
|
|
6756
|
+
if (f != null) {
|
|
6757
|
+
writer.writeFloat(
|
|
6758
|
+
4,
|
|
6759
|
+
f
|
|
6760
|
+
);
|
|
6761
|
+
}
|
|
6762
|
+
f = /** @type {string} */ (jspb.Message.getField(message, 5));
|
|
6763
|
+
if (f != null) {
|
|
6764
|
+
writer.writeString(
|
|
6765
|
+
5,
|
|
6766
|
+
f
|
|
6767
|
+
);
|
|
6768
|
+
}
|
|
6769
|
+
f = /** @type {number} */ (jspb.Message.getField(message, 6));
|
|
6770
|
+
if (f != null) {
|
|
6771
|
+
writer.writeUint32(
|
|
6772
|
+
6,
|
|
6773
|
+
f
|
|
6774
|
+
);
|
|
6775
|
+
}
|
|
6776
|
+
f = /** @type {string} */ (jspb.Message.getField(message, 7));
|
|
6777
|
+
if (f != null) {
|
|
6778
|
+
writer.writeString(
|
|
6779
|
+
7,
|
|
6780
|
+
f
|
|
6781
|
+
);
|
|
6782
|
+
}
|
|
6783
|
+
};
|
|
6784
|
+
|
|
6785
|
+
|
|
6786
|
+
/**
|
|
6787
|
+
* optional string method = 1;
|
|
6788
|
+
* @return {string}
|
|
6789
|
+
*/
|
|
6790
|
+
proto.hyperspace.Bm25Options.prototype.getMethod = function() {
|
|
6791
|
+
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
|
|
6792
|
+
};
|
|
6793
|
+
|
|
6794
|
+
|
|
6795
|
+
/**
|
|
6796
|
+
* @param {string} value
|
|
6797
|
+
* @return {!proto.hyperspace.Bm25Options} returns this
|
|
6798
|
+
*/
|
|
6799
|
+
proto.hyperspace.Bm25Options.prototype.setMethod = function(value) {
|
|
6800
|
+
return jspb.Message.setField(this, 1, value);
|
|
6801
|
+
};
|
|
6802
|
+
|
|
6803
|
+
|
|
6804
|
+
/**
|
|
6805
|
+
* Clears the field making it undefined.
|
|
6806
|
+
* @return {!proto.hyperspace.Bm25Options} returns this
|
|
6807
|
+
*/
|
|
6808
|
+
proto.hyperspace.Bm25Options.prototype.clearMethod = function() {
|
|
6809
|
+
return jspb.Message.setField(this, 1, undefined);
|
|
6810
|
+
};
|
|
6811
|
+
|
|
6812
|
+
|
|
6813
|
+
/**
|
|
6814
|
+
* Returns whether this field is set.
|
|
6815
|
+
* @return {boolean}
|
|
6816
|
+
*/
|
|
6817
|
+
proto.hyperspace.Bm25Options.prototype.hasMethod = function() {
|
|
6818
|
+
return jspb.Message.getField(this, 1) != null;
|
|
6819
|
+
};
|
|
6820
|
+
|
|
6821
|
+
|
|
6822
|
+
/**
|
|
6823
|
+
* optional float k1 = 2;
|
|
6824
|
+
* @return {number}
|
|
6825
|
+
*/
|
|
6826
|
+
proto.hyperspace.Bm25Options.prototype.getK1 = function() {
|
|
6827
|
+
return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 2, 0.0));
|
|
6828
|
+
};
|
|
6829
|
+
|
|
6830
|
+
|
|
6831
|
+
/**
|
|
6832
|
+
* @param {number} value
|
|
6833
|
+
* @return {!proto.hyperspace.Bm25Options} returns this
|
|
6834
|
+
*/
|
|
6835
|
+
proto.hyperspace.Bm25Options.prototype.setK1 = function(value) {
|
|
6836
|
+
return jspb.Message.setField(this, 2, value);
|
|
6837
|
+
};
|
|
6838
|
+
|
|
6839
|
+
|
|
6840
|
+
/**
|
|
6841
|
+
* Clears the field making it undefined.
|
|
6842
|
+
* @return {!proto.hyperspace.Bm25Options} returns this
|
|
6843
|
+
*/
|
|
6844
|
+
proto.hyperspace.Bm25Options.prototype.clearK1 = function() {
|
|
6845
|
+
return jspb.Message.setField(this, 2, undefined);
|
|
6846
|
+
};
|
|
6847
|
+
|
|
6848
|
+
|
|
6849
|
+
/**
|
|
6850
|
+
* Returns whether this field is set.
|
|
6851
|
+
* @return {boolean}
|
|
6852
|
+
*/
|
|
6853
|
+
proto.hyperspace.Bm25Options.prototype.hasK1 = function() {
|
|
6854
|
+
return jspb.Message.getField(this, 2) != null;
|
|
6855
|
+
};
|
|
6856
|
+
|
|
6857
|
+
|
|
6858
|
+
/**
|
|
6859
|
+
* optional float b = 3;
|
|
6860
|
+
* @return {number}
|
|
6861
|
+
*/
|
|
6862
|
+
proto.hyperspace.Bm25Options.prototype.getB = function() {
|
|
6863
|
+
return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 3, 0.0));
|
|
6864
|
+
};
|
|
6865
|
+
|
|
6866
|
+
|
|
6867
|
+
/**
|
|
6868
|
+
* @param {number} value
|
|
6869
|
+
* @return {!proto.hyperspace.Bm25Options} returns this
|
|
6870
|
+
*/
|
|
6871
|
+
proto.hyperspace.Bm25Options.prototype.setB = function(value) {
|
|
6872
|
+
return jspb.Message.setField(this, 3, value);
|
|
6873
|
+
};
|
|
6874
|
+
|
|
6875
|
+
|
|
6876
|
+
/**
|
|
6877
|
+
* Clears the field making it undefined.
|
|
6878
|
+
* @return {!proto.hyperspace.Bm25Options} returns this
|
|
6879
|
+
*/
|
|
6880
|
+
proto.hyperspace.Bm25Options.prototype.clearB = function() {
|
|
6881
|
+
return jspb.Message.setField(this, 3, undefined);
|
|
6882
|
+
};
|
|
6883
|
+
|
|
6884
|
+
|
|
6885
|
+
/**
|
|
6886
|
+
* Returns whether this field is set.
|
|
6887
|
+
* @return {boolean}
|
|
6888
|
+
*/
|
|
6889
|
+
proto.hyperspace.Bm25Options.prototype.hasB = function() {
|
|
6890
|
+
return jspb.Message.getField(this, 3) != null;
|
|
6891
|
+
};
|
|
6892
|
+
|
|
6893
|
+
|
|
6894
|
+
/**
|
|
6895
|
+
* optional float delta = 4;
|
|
6896
|
+
* @return {number}
|
|
6897
|
+
*/
|
|
6898
|
+
proto.hyperspace.Bm25Options.prototype.getDelta = function() {
|
|
6899
|
+
return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 4, 0.0));
|
|
6900
|
+
};
|
|
6901
|
+
|
|
6902
|
+
|
|
6903
|
+
/**
|
|
6904
|
+
* @param {number} value
|
|
6905
|
+
* @return {!proto.hyperspace.Bm25Options} returns this
|
|
6906
|
+
*/
|
|
6907
|
+
proto.hyperspace.Bm25Options.prototype.setDelta = function(value) {
|
|
6908
|
+
return jspb.Message.setField(this, 4, value);
|
|
6909
|
+
};
|
|
6910
|
+
|
|
6911
|
+
|
|
6912
|
+
/**
|
|
6913
|
+
* Clears the field making it undefined.
|
|
6914
|
+
* @return {!proto.hyperspace.Bm25Options} returns this
|
|
6915
|
+
*/
|
|
6916
|
+
proto.hyperspace.Bm25Options.prototype.clearDelta = function() {
|
|
6917
|
+
return jspb.Message.setField(this, 4, undefined);
|
|
6918
|
+
};
|
|
6919
|
+
|
|
6920
|
+
|
|
6921
|
+
/**
|
|
6922
|
+
* Returns whether this field is set.
|
|
6923
|
+
* @return {boolean}
|
|
6924
|
+
*/
|
|
6925
|
+
proto.hyperspace.Bm25Options.prototype.hasDelta = function() {
|
|
6926
|
+
return jspb.Message.getField(this, 4) != null;
|
|
6927
|
+
};
|
|
6928
|
+
|
|
6929
|
+
|
|
6930
|
+
/**
|
|
6931
|
+
* optional string language = 5;
|
|
6932
|
+
* @return {string}
|
|
6933
|
+
*/
|
|
6934
|
+
proto.hyperspace.Bm25Options.prototype.getLanguage = function() {
|
|
6935
|
+
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 5, ""));
|
|
6936
|
+
};
|
|
6937
|
+
|
|
6938
|
+
|
|
6939
|
+
/**
|
|
6940
|
+
* @param {string} value
|
|
6941
|
+
* @return {!proto.hyperspace.Bm25Options} returns this
|
|
6942
|
+
*/
|
|
6943
|
+
proto.hyperspace.Bm25Options.prototype.setLanguage = function(value) {
|
|
6944
|
+
return jspb.Message.setField(this, 5, value);
|
|
6945
|
+
};
|
|
6946
|
+
|
|
6947
|
+
|
|
6948
|
+
/**
|
|
6949
|
+
* Clears the field making it undefined.
|
|
6950
|
+
* @return {!proto.hyperspace.Bm25Options} returns this
|
|
6951
|
+
*/
|
|
6952
|
+
proto.hyperspace.Bm25Options.prototype.clearLanguage = function() {
|
|
6953
|
+
return jspb.Message.setField(this, 5, undefined);
|
|
6954
|
+
};
|
|
6955
|
+
|
|
6956
|
+
|
|
6957
|
+
/**
|
|
6958
|
+
* Returns whether this field is set.
|
|
6959
|
+
* @return {boolean}
|
|
6960
|
+
*/
|
|
6961
|
+
proto.hyperspace.Bm25Options.prototype.hasLanguage = function() {
|
|
6962
|
+
return jspb.Message.getField(this, 5) != null;
|
|
6963
|
+
};
|
|
6964
|
+
|
|
6965
|
+
|
|
6966
|
+
/**
|
|
6967
|
+
* optional uint32 ngrams = 6;
|
|
6968
|
+
* @return {number}
|
|
6969
|
+
*/
|
|
6970
|
+
proto.hyperspace.Bm25Options.prototype.getNgrams = function() {
|
|
6971
|
+
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 6, 0));
|
|
6972
|
+
};
|
|
6973
|
+
|
|
6974
|
+
|
|
6975
|
+
/**
|
|
6976
|
+
* @param {number} value
|
|
6977
|
+
* @return {!proto.hyperspace.Bm25Options} returns this
|
|
6978
|
+
*/
|
|
6979
|
+
proto.hyperspace.Bm25Options.prototype.setNgrams = function(value) {
|
|
6980
|
+
return jspb.Message.setField(this, 6, value);
|
|
6981
|
+
};
|
|
6982
|
+
|
|
6983
|
+
|
|
6984
|
+
/**
|
|
6985
|
+
* Clears the field making it undefined.
|
|
6986
|
+
* @return {!proto.hyperspace.Bm25Options} returns this
|
|
6987
|
+
*/
|
|
6988
|
+
proto.hyperspace.Bm25Options.prototype.clearNgrams = function() {
|
|
6989
|
+
return jspb.Message.setField(this, 6, undefined);
|
|
6990
|
+
};
|
|
6991
|
+
|
|
6992
|
+
|
|
6993
|
+
/**
|
|
6994
|
+
* Returns whether this field is set.
|
|
6995
|
+
* @return {boolean}
|
|
6996
|
+
*/
|
|
6997
|
+
proto.hyperspace.Bm25Options.prototype.hasNgrams = function() {
|
|
6998
|
+
return jspb.Message.getField(this, 6) != null;
|
|
6999
|
+
};
|
|
7000
|
+
|
|
7001
|
+
|
|
7002
|
+
/**
|
|
7003
|
+
* optional string fusion_method = 7;
|
|
7004
|
+
* @return {string}
|
|
7005
|
+
*/
|
|
7006
|
+
proto.hyperspace.Bm25Options.prototype.getFusionMethod = function() {
|
|
7007
|
+
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 7, ""));
|
|
7008
|
+
};
|
|
7009
|
+
|
|
7010
|
+
|
|
7011
|
+
/**
|
|
7012
|
+
* @param {string} value
|
|
7013
|
+
* @return {!proto.hyperspace.Bm25Options} returns this
|
|
7014
|
+
*/
|
|
7015
|
+
proto.hyperspace.Bm25Options.prototype.setFusionMethod = function(value) {
|
|
7016
|
+
return jspb.Message.setField(this, 7, value);
|
|
7017
|
+
};
|
|
7018
|
+
|
|
7019
|
+
|
|
7020
|
+
/**
|
|
7021
|
+
* Clears the field making it undefined.
|
|
7022
|
+
* @return {!proto.hyperspace.Bm25Options} returns this
|
|
7023
|
+
*/
|
|
7024
|
+
proto.hyperspace.Bm25Options.prototype.clearFusionMethod = function() {
|
|
7025
|
+
return jspb.Message.setField(this, 7, undefined);
|
|
7026
|
+
};
|
|
7027
|
+
|
|
7028
|
+
|
|
7029
|
+
/**
|
|
7030
|
+
* Returns whether this field is set.
|
|
7031
|
+
* @return {boolean}
|
|
7032
|
+
*/
|
|
7033
|
+
proto.hyperspace.Bm25Options.prototype.hasFusionMethod = function() {
|
|
7034
|
+
return jspb.Message.getField(this, 7) != null;
|
|
7035
|
+
};
|
|
7036
|
+
|
|
7037
|
+
|
|
6481
7038
|
|
|
6482
7039
|
|
|
6483
7040
|
|
|
@@ -6945,7 +7502,8 @@ proto.hyperspace.SearchRequest.toObject = function(includeInstance, msg) {
|
|
|
6945
7502
|
proto.hyperspace.Filter.toObject, includeInstance),
|
|
6946
7503
|
hybridQuery: jspb.Message.getFieldWithDefault(msg, 6, ""),
|
|
6947
7504
|
hybridAlpha: jspb.Message.getFloatingPointFieldWithDefault(msg, 7, 0.0),
|
|
6948
|
-
useWasserstein: jspb.Message.getBooleanFieldWithDefault(msg, 8, false)
|
|
7505
|
+
useWasserstein: jspb.Message.getBooleanFieldWithDefault(msg, 8, false),
|
|
7506
|
+
bm25Options: (f = msg.getBm25Options()) && proto.hyperspace.Bm25Options.toObject(includeInstance, f)
|
|
6949
7507
|
};
|
|
6950
7508
|
|
|
6951
7509
|
if (includeInstance) {
|
|
@@ -7019,6 +7577,11 @@ proto.hyperspace.SearchRequest.deserializeBinaryFromReader = function(msg, reade
|
|
|
7019
7577
|
var value = /** @type {boolean} */ (reader.readBool());
|
|
7020
7578
|
msg.setUseWasserstein(value);
|
|
7021
7579
|
break;
|
|
7580
|
+
case 9:
|
|
7581
|
+
var value = new proto.hyperspace.Bm25Options;
|
|
7582
|
+
reader.readMessage(value,proto.hyperspace.Bm25Options.deserializeBinaryFromReader);
|
|
7583
|
+
msg.setBm25Options(value);
|
|
7584
|
+
break;
|
|
7022
7585
|
default:
|
|
7023
7586
|
reader.skipField();
|
|
7024
7587
|
break;
|
|
@@ -7102,6 +7665,14 @@ proto.hyperspace.SearchRequest.serializeBinaryToWriter = function(message, write
|
|
|
7102
7665
|
f
|
|
7103
7666
|
);
|
|
7104
7667
|
}
|
|
7668
|
+
f = message.getBm25Options();
|
|
7669
|
+
if (f != null) {
|
|
7670
|
+
writer.writeMessage(
|
|
7671
|
+
9,
|
|
7672
|
+
f,
|
|
7673
|
+
proto.hyperspace.Bm25Options.serializeBinaryToWriter
|
|
7674
|
+
);
|
|
7675
|
+
}
|
|
7105
7676
|
};
|
|
7106
7677
|
|
|
7107
7678
|
|
|
@@ -7328,6 +7899,43 @@ proto.hyperspace.SearchRequest.prototype.setUseWasserstein = function(value) {
|
|
|
7328
7899
|
};
|
|
7329
7900
|
|
|
7330
7901
|
|
|
7902
|
+
/**
|
|
7903
|
+
* optional Bm25Options bm25_options = 9;
|
|
7904
|
+
* @return {?proto.hyperspace.Bm25Options}
|
|
7905
|
+
*/
|
|
7906
|
+
proto.hyperspace.SearchRequest.prototype.getBm25Options = function() {
|
|
7907
|
+
return /** @type{?proto.hyperspace.Bm25Options} */ (
|
|
7908
|
+
jspb.Message.getWrapperField(this, proto.hyperspace.Bm25Options, 9));
|
|
7909
|
+
};
|
|
7910
|
+
|
|
7911
|
+
|
|
7912
|
+
/**
|
|
7913
|
+
* @param {?proto.hyperspace.Bm25Options|undefined} value
|
|
7914
|
+
* @return {!proto.hyperspace.SearchRequest} returns this
|
|
7915
|
+
*/
|
|
7916
|
+
proto.hyperspace.SearchRequest.prototype.setBm25Options = function(value) {
|
|
7917
|
+
return jspb.Message.setWrapperField(this, 9, value);
|
|
7918
|
+
};
|
|
7919
|
+
|
|
7920
|
+
|
|
7921
|
+
/**
|
|
7922
|
+
* Clears the message field making it undefined.
|
|
7923
|
+
* @return {!proto.hyperspace.SearchRequest} returns this
|
|
7924
|
+
*/
|
|
7925
|
+
proto.hyperspace.SearchRequest.prototype.clearBm25Options = function() {
|
|
7926
|
+
return this.setBm25Options(undefined);
|
|
7927
|
+
};
|
|
7928
|
+
|
|
7929
|
+
|
|
7930
|
+
/**
|
|
7931
|
+
* Returns whether this field is set.
|
|
7932
|
+
* @return {boolean}
|
|
7933
|
+
*/
|
|
7934
|
+
proto.hyperspace.SearchRequest.prototype.hasBm25Options = function() {
|
|
7935
|
+
return jspb.Message.getField(this, 9) != null;
|
|
7936
|
+
};
|
|
7937
|
+
|
|
7938
|
+
|
|
7331
7939
|
|
|
7332
7940
|
/**
|
|
7333
7941
|
* Oneof group definitions for this message. Each group defines the field
|