Skip to content

Commit 27fec48

Browse files
authored
Merge pull request #82 from apisearch-io/feature/build-dist
Built dist
2 parents 3a719bc + 1e3362c commit 27fec48

File tree

6 files changed

+34
-16
lines changed

6 files changed

+34
-16
lines changed

dist/apisearch.js

Lines changed: 15 additions & 6 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/Query/Query.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,7 @@ export declare class Query {
608608
*
609609
* @return {string|null}
610610
*/
611-
getUUID(): string;
611+
getUUID(): string | null;
612612
/**
613613
* Force Index UUID.
614614
*

lib/Query/Query.js

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ var Query = /** @class */ (function () {
3131
* @param queryText
3232
*/
3333
function Query(queryText) {
34+
this.UUID = null;
3435
this.fields = [];
3536
this.universeFilters = {};
3637
this.filters = {};
@@ -42,6 +43,7 @@ var Query = /** @class */ (function () {
4243
this.highlightsEnabled = false;
4344
this.autocompleteEnabled = false;
4445
this.searchableFields = [];
46+
this.fuzziness = null;
4547
this.minScore = exports.NO_MIN_SCORE;
4648
this.metadata = {};
4749
this.subqueries = {};
@@ -977,7 +979,9 @@ var Query = /** @class */ (function () {
977979
*/
978980
Query.prototype.toArray = function () {
979981
var array = {};
980-
array.UUID = this.UUID;
982+
if (this.UUID !== null) {
983+
array.UUID = this.UUID;
984+
}
981985
if (this.getQueryText() !== "") {
982986
array.q = this.getQueryText();
983987
}
@@ -1006,13 +1010,16 @@ var Query = /** @class */ (function () {
10061010
*/
10071011
if (this.filters instanceof Object &&
10081012
Object.keys(this.filters).length) {
1009-
array.filters = {};
1013+
var filters = {};
10101014
for (var i in this.filters) {
10111015
var filter = this.filters[i];
10121016
if (filter.getFilterType() !== Filter_3.FILTER_TYPE_QUERY) {
1013-
array.filters[i] = filter.toArray();
1017+
filters[i] = filter.toArray();
10141018
}
10151019
}
1020+
if (Object.keys(filters).length > 0) {
1021+
array.filters = filters;
1022+
}
10161023
}
10171024
/**
10181025
* Aggregations
@@ -1096,7 +1103,9 @@ var Query = /** @class */ (function () {
10961103
if (this.user instanceof User_1.User) {
10971104
array.user = this.user.toArray();
10981105
}
1099-
array.metadata = this.metadata;
1106+
if (Object.keys(this.metadata).length > 0) {
1107+
array.metadata = this.metadata;
1108+
}
11001109
if (this.subqueries instanceof Object &&
11011110
Object.keys(this.subqueries).length) {
11021111
array.subqueries = {};
@@ -1119,7 +1128,7 @@ var Query = /** @class */ (function () {
11191128
.push(this.itemsPromoted[i].toArray());
11201129
}
11211130
}
1122-
if (this.queryOperator !== "or") {
1131+
if (this.queryOperator !== "or" && this.queryOperator !== null) {
11231132
array.query_operator = this.queryOperator;
11241133
}
11251134
return array;
@@ -1198,7 +1207,7 @@ var Query = /** @class */ (function () {
11981207
query.highlightsEnabled = typeof array.highlight_enabled === "boolean"
11991208
? array.highlight_enabled
12001209
: false;
1201-
query.fuzziness = array.fuzziness;
1210+
query.fuzziness = array.fuzziness ? array.fuzziness : null;
12021211
query.minScore = array.min_score ? array.min_score : exports.NO_MIN_SCORE;
12031212
/**
12041213
* Items promoted

0 commit comments

Comments
 (0)