Skip to content
This repository was archived by the owner on Jun 25, 2025. It is now read-only.

Commit 564e443

Browse files
authored
Created distribution and going to 0.2.14 (#25)
1 parent 63bad26 commit 564e443

File tree

9 files changed

+233
-8
lines changed

9 files changed

+233
-8
lines changed

dist/apisearch.js

Lines changed: 91 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/apisearch.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/apisearch.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/apisearch.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/Model/Item.d.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export declare class Item {
1414
private suggest;
1515
private highlights;
1616
private promoted;
17+
private score;
1718
/**
1819
* Constructor
1920
*
@@ -196,6 +197,20 @@ export declare class Item {
196197
* @returns boolean
197198
*/
198199
isPromoted(): boolean;
200+
/**
201+
* Set score
202+
*
203+
* @param score
204+
*
205+
* @return {Item}
206+
*/
207+
setScore(score: number): Item;
208+
/**
209+
* Get score
210+
*
211+
* @return {number}
212+
*/
213+
getScore(): number;
199214
/**
200215
* To array
201216
*/
@@ -210,6 +225,7 @@ export declare class Item {
210225
highlights?: {};
211226
is_promoted?: boolean;
212227
distance?: number;
228+
score?: number;
213229
};
214230
/**
215231
* Create from array

lib/Model/Item.js

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,25 @@ var Item = /** @class */ (function () {
270270
Item.prototype.isPromoted = function () {
271271
return this.promoted;
272272
};
273+
/**
274+
* Set score
275+
*
276+
* @param score
277+
*
278+
* @return {Item}
279+
*/
280+
Item.prototype.setScore = function (score) {
281+
this.score = score;
282+
return this;
283+
};
284+
/**
285+
* Get score
286+
*
287+
* @return {number}
288+
*/
289+
Item.prototype.getScore = function () {
290+
return this.score;
291+
};
273292
/**
274293
* To array
275294
*/
@@ -304,6 +323,9 @@ var Item = /** @class */ (function () {
304323
if (typeof this.distance != "undefined") {
305324
itemAsArray.distance = this.distance;
306325
}
326+
if (typeof this.score != "undefined") {
327+
itemAsArray.score = this.score;
328+
}
307329
return itemAsArray;
308330
};
309331
/**
@@ -332,8 +354,13 @@ var Item = /** @class */ (function () {
332354
array.distance != null) {
333355
item.highlights = array.highlights;
334356
}
335-
if (array.is_promoted) {
336-
item.promoted = true;
357+
if (typeof array.is_promoted != "undefined" &&
358+
array.is_promoted != null) {
359+
item.promoted = array.is_promoted;
360+
}
361+
if (typeof array.score != "undefined" &&
362+
array.score != null) {
363+
item.score = array.score;
337364
}
338365
return item;
339366
};

lib/Query/Query.d.ts

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,13 @@ export declare const QUERY_DEFAULT_FROM = 0;
1313
export declare const QUERY_DEFAULT_PAGE = 1;
1414
export declare const QUERY_DEFAULT_SIZE = 10;
1515
export declare const QUERY_INFINITE_SIZE = 1000;
16+
export declare const NO_MIN_SCORE = 0;
1617
/**
1718
* Query class
1819
*/
1920
export declare class Query {
2021
private coordinate;
22+
private fields;
2123
private universeFilters;
2224
private filters;
2325
private itemsPromoted;
@@ -33,6 +35,7 @@ export declare class Query {
3335
private filterFields;
3436
private scoreStrategy;
3537
private fuzziness;
38+
private minScore;
3639
private user;
3740
/**
3841
* Constructor
@@ -83,6 +86,20 @@ export declare class Query {
8386
* @return {Query}
8487
*/
8588
static createByUUIDs(...uuids: ItemUUID[]): Query;
89+
/**
90+
* set fields
91+
*
92+
* @param fields
93+
*
94+
* @return {Query}
95+
*/
96+
setFields(fields: string[]): Query;
97+
/**
98+
* get fields
99+
*
100+
* @return {string[]}
101+
*/
102+
getFields(): string[];
86103
/**
87104
* Filter universe by types
88105
*
@@ -481,6 +498,20 @@ export declare class Query {
481498
* @return {Query}
482499
*/
483500
setAutoFuzziness(): Query;
501+
/**
502+
* Get min score
503+
*
504+
* @return any
505+
*/
506+
getMinScore(): any;
507+
/**
508+
* Set min score
509+
*
510+
* @param minScore
511+
*
512+
* @return {Query}
513+
*/
514+
setMinScore(minScore: number): Query;
484515
/**
485516
* By user
486517
*

0 commit comments

Comments
 (0)