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

Commit 04bf04a

Browse files
authored
Merge pull request #61 from apisearch-io/fix/fixed-highlight-field
Fixed highlight_enabled field name
2 parents daaf43b + 4c73028 commit 04bf04a

File tree

9 files changed

+38
-32
lines changed

9 files changed

+38
-32
lines changed

dist/apisearch.js

Lines changed: 3 additions & 3 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.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,7 +1018,7 @@ var Query = /** @class */ (function () {
10181018
array.suggestions_enabled = true;
10191019
}
10201020
if (this.highlightsEnabled === true) {
1021-
array.highlights_enabled = true;
1021+
array.highlight_enabled = true;
10221022
}
10231023
if (this.aggregationsEnabled === false) {
10241024
array.aggregations_enabled = false;
@@ -1148,8 +1148,8 @@ var Query = /** @class */ (function () {
11481148
query.aggregationsEnabled = typeof array.aggregations_enabled === "boolean"
11491149
? array.aggregations_enabled
11501150
: true;
1151-
query.highlightsEnabled = typeof array.highlights_enabled === "boolean"
1152-
? array.highlights_enabled
1151+
query.highlightsEnabled = typeof array.highlight_enabled === "boolean"
1152+
? array.highlight_enabled
11531153
: false;
11541154
query.fuzziness = array.fuzziness;
11551155
query.minScore = array.min_score ? array.min_score : exports.NO_MIN_SCORE;

package-lock.json

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

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "apisearch",
3-
"version": "0.2.28",
3+
"version": "0.2.29",
44
"description": "Javascript client for Apisearch.",
55
"main": "lib/index.js",
66
"types": "lib/index.d.ts",

src/Query/Query.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1350,7 +1350,7 @@ export class Query {
13501350
}
13511351

13521352
if (this.highlightsEnabled === true) {
1353-
array.highlights_enabled = true;
1353+
array.highlight_enabled = true;
13541354
}
13551355

13561356
if (this.aggregationsEnabled === false) {
@@ -1519,8 +1519,8 @@ export class Query {
15191519
? array.aggregations_enabled
15201520
: true;
15211521

1522-
query.highlightsEnabled = typeof array.highlights_enabled === "boolean"
1523-
? array.highlights_enabled
1522+
query.highlightsEnabled = typeof array.highlight_enabled === "boolean"
1523+
? array.highlight_enabled
15241524
: false;
15251525

15261526
query.fuzziness = array.fuzziness;

test/Query/Query.test.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -623,15 +623,18 @@ describe('Query()', () => {
623623
it('should set and unset suggestions properly', () => {
624624
query.enableSuggestions();
625625
expect(query.areSuggestionsEnabled()).to.be.true;
626+
expect(query.toArray().suggestions_enabled).to.be.true;
626627
query.disableSuggestions();
627628
expect(query.areSuggestionsEnabled()).to.be.false;
629+
expect(query.toArray().suggestions_enabled).to.be.undefined;
628630
});
629631

630632
it('should set and unset highlights properly', () => {
631633
query.enableHighlights();
632634
expect(query.areHighlightsEnabled()).to.be.true;
635+
expect(query.toArray().highlight_enabled).to.be.true;
633636
query.disableHighlights();
634-
expect(query.areHighlightsEnabled()).to.be.false;
637+
expect(query.toArray().highlight_enabled).to.be.undefined;
635638
});
636639
});
637640

0 commit comments

Comments
 (0)