Skip to content
This repository was archived by the owner on Jun 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 91 additions & 2 deletions dist/apisearch.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/apisearch.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/apisearch.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/apisearch.min.js.map

Large diffs are not rendered by default.

16 changes: 16 additions & 0 deletions lib/Model/Item.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export declare class Item {
private suggest;
private highlights;
private promoted;
private score;
/**
* Constructor
*
Expand Down Expand Up @@ -196,6 +197,20 @@ export declare class Item {
* @returns boolean
*/
isPromoted(): boolean;
/**
* Set score
*
* @param score
*
* @return {Item}
*/
setScore(score: number): Item;
/**
* Get score
*
* @return {number}
*/
getScore(): number;
/**
* To array
*/
Expand All @@ -210,6 +225,7 @@ export declare class Item {
highlights?: {};
is_promoted?: boolean;
distance?: number;
score?: number;
};
/**
* Create from array
Expand Down
31 changes: 29 additions & 2 deletions lib/Model/Item.js
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,25 @@ var Item = /** @class */ (function () {
Item.prototype.isPromoted = function () {
return this.promoted;
};
/**
* Set score
*
* @param score
*
* @return {Item}
*/
Item.prototype.setScore = function (score) {
this.score = score;
return this;
};
/**
* Get score
*
* @return {number}
*/
Item.prototype.getScore = function () {
return this.score;
};
/**
* To array
*/
Expand Down Expand Up @@ -304,6 +323,9 @@ var Item = /** @class */ (function () {
if (typeof this.distance != "undefined") {
itemAsArray.distance = this.distance;
}
if (typeof this.score != "undefined") {
itemAsArray.score = this.score;
}
return itemAsArray;
};
/**
Expand Down Expand Up @@ -332,8 +354,13 @@ var Item = /** @class */ (function () {
array.distance != null) {
item.highlights = array.highlights;
}
if (array.is_promoted) {
item.promoted = true;
if (typeof array.is_promoted != "undefined" &&
array.is_promoted != null) {
item.promoted = array.is_promoted;
}
if (typeof array.score != "undefined" &&
array.score != null) {
item.score = array.score;
}
return item;
};
Expand Down
31 changes: 31 additions & 0 deletions lib/Query/Query.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@ export declare const QUERY_DEFAULT_FROM = 0;
export declare const QUERY_DEFAULT_PAGE = 1;
export declare const QUERY_DEFAULT_SIZE = 10;
export declare const QUERY_INFINITE_SIZE = 1000;
export declare const NO_MIN_SCORE = 0;
/**
* Query class
*/
export declare class Query {
private coordinate;
private fields;
private universeFilters;
private filters;
private itemsPromoted;
Expand All @@ -33,6 +35,7 @@ export declare class Query {
private filterFields;
private scoreStrategy;
private fuzziness;
private minScore;
private user;
/**
* Constructor
Expand Down Expand Up @@ -83,6 +86,20 @@ export declare class Query {
* @return {Query}
*/
static createByUUIDs(...uuids: ItemUUID[]): Query;
/**
* set fields
*
* @param fields
*
* @return {Query}
*/
setFields(fields: string[]): Query;
/**
* get fields
*
* @return {string[]}
*/
getFields(): string[];
/**
* Filter universe by types
*
Expand Down Expand Up @@ -481,6 +498,20 @@ export declare class Query {
* @return {Query}
*/
setAutoFuzziness(): Query;
/**
* Get min score
*
* @return any
*/
getMinScore(): any;
/**
* Set min score
*
* @param minScore
*
* @return {Query}
*/
setMinScore(minScore: number): Query;
/**
* By user
*
Expand Down
Loading