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

Commit 19bdd84

Browse files
authored
Merge pull request #62 from apisearch-io/fix/tested-highlights
Tested suggestions and highlights
2 parents 04bf04a + c789f48 commit 19bdd84

File tree

16 files changed

+98
-89
lines changed

16 files changed

+98
-89
lines changed

dist/apisearch.js

Lines changed: 12 additions & 20 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.

docker-compose/docker-compose-infra.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ services:
55
elasticsearch:
66
image: "docker.elastic.co/elasticsearch/elasticsearch:7.6.0"
77
networks: [apisearch]
8+
ports:
9+
- 9200:9200
810
environment:
911
- "ES_JAVA_OPTS=-Xms256m -Xmx256m"
1012
- "discovery.type=single-node"
@@ -18,9 +20,6 @@ services:
1820
environment:
1921
APISEARCH_GOD_TOKEN: 0e4d75ba-c640-44c1-a745-06ee51db4e93
2022
APISEARCH_ENABLED_PLUGINS: elasticsearch
21-
APISEARCH_EVENTS_EXCHANGE: events
22-
APISEARCH_TOKENS_UPDATE_EXCHANGE: tokens_update
23-
APISEARCH_ASYNC_EVENTS_ADAPTER: in_memory
2423
ELASTICSEARCH_HOST: elasticsearch
2524
ELASTICSEARCH_REFRESH_ON_WRITE: 1
2625

lib/Model/Item.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ var Item = /** @class */ (function () {
375375
item.distance = array.distance;
376376
}
377377
if (typeof array.highlights == "object" &&
378-
array.distance != null) {
378+
array.highlights != null) {
379379
item.highlights = array.highlights;
380380
}
381381
if (typeof array.is_promoted != "undefined" &&

lib/Repository/HttpRepository.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ var HttpRepository = /** @class */ (function (_super) {
422422
}.bind(this));
423423
return Result_1.Result.createMultiresults(subresults);
424424
}
425-
return Result_1.Result.create(result.getQueryUUID(), result.getTotalItems(), result.getTotalHits(), result.getAggregations(), result.getSuggests(), this
425+
return Result_1.Result.create(result.getQueryUUID(), result.getTotalItems(), result.getTotalHits(), result.getAggregations(), result.getSuggestions(), this
426426
.transformer
427427
.fromItems(result.getItems()));
428428
};

lib/Result/Result.d.ts

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { ResultAggregations } from "./ResultAggregations";
77
export declare class Result {
88
private queryUUID;
99
private items;
10-
private suggests;
10+
private suggestions;
1111
private aggregations;
1212
private totalItems;
1313
private totalHits;
@@ -28,12 +28,12 @@ export declare class Result {
2828
* @param totalItems
2929
* @param totalHits
3030
* @param aggregations
31-
* @param suggests
31+
* @param suggestions
3232
* @param items
3333
*
3434
* @returns {Result}
3535
*/
36-
static create(queryUUID: string, totalItems: number, totalHits: number, aggregations: ResultAggregations, suggests: string[], items: Item[]): Result;
36+
static create(queryUUID: string, totalItems: number, totalHits: number, aggregations: ResultAggregations, suggestions: string[], items: Item[]): Result;
3737
/**
3838
* Create multi results
3939
*
@@ -109,17 +109,11 @@ export declare class Result {
109109
*/
110110
hasNotEmptyAggregation(name: string): boolean;
111111
/**
112-
* Add suggest
113-
*
114-
* @param suggest
115-
*/
116-
addSuggest(suggest: string): void;
117-
/**
118-
* Get suggests
112+
* Get suggestions
119113
*
120114
* @return {string[]}
121115
*/
122-
getSuggests(): string[];
116+
getSuggestions(): string[];
123117
/**
124118
* Get query uuid
125119
*
@@ -147,7 +141,7 @@ export declare class Result {
147141
/**
148142
* to array
149143
*
150-
* @return {{query: any, total_items: number, total_hits: number, items:any[], aggregations: any, suggests: string[]}}
144+
* @return {{query: any, total_items: number, total_hits: number, items:any[], aggregations: any, suggestions: string[]}}
151145
*/
152146
toArray(): any;
153147
/**

lib/Result/Result.js

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ var Result = /** @class */ (function () {
1515
*/
1616
function Result(queryUUID, totalItems, totalHits) {
1717
this.items = [];
18-
this.suggests = [];
18+
this.suggestions = [];
1919
this.subresults = {};
2020
this.queryUUID = queryUUID;
2121
this.totalItems = totalItems;
@@ -28,15 +28,15 @@ var Result = /** @class */ (function () {
2828
* @param totalItems
2929
* @param totalHits
3030
* @param aggregations
31-
* @param suggests
31+
* @param suggestions
3232
* @param items
3333
*
3434
* @returns {Result}
3535
*/
36-
Result.create = function (queryUUID, totalItems, totalHits, aggregations, suggests, items) {
36+
Result.create = function (queryUUID, totalItems, totalHits, aggregations, suggestions, items) {
3737
var result = new Result(queryUUID, totalItems, totalHits);
3838
result.aggregations = aggregations;
39-
result.suggests = suggests;
39+
result.suggestions = suggestions;
4040
result.items = items;
4141
return result;
4242
};
@@ -163,20 +163,12 @@ var Result = /** @class */ (function () {
163163
: this.aggregations.hasNotEmptyAggregation(name);
164164
};
165165
/**
166-
* Add suggest
167-
*
168-
* @param suggest
169-
*/
170-
Result.prototype.addSuggest = function (suggest) {
171-
this.suggests.push(suggest);
172-
};
173-
/**
174-
* Get suggests
166+
* Get suggestions
175167
*
176168
* @return {string[]}
177169
*/
178-
Result.prototype.getSuggests = function () {
179-
return this.suggests;
170+
Result.prototype.getSuggestions = function () {
171+
return this.suggestions;
180172
};
181173
/**
182174
* Get query uuid
@@ -213,7 +205,7 @@ var Result = /** @class */ (function () {
213205
/**
214206
* to array
215207
*
216-
* @return {{query: any, total_items: number, total_hits: number, items:any[], aggregations: any, suggests: string[]}}
208+
* @return {{query: any, total_items: number, total_hits: number, items:any[], aggregations: any, suggestions: string[]}}
217209
*/
218210
Result.prototype.toArray = function () {
219211
var array = {
@@ -224,7 +216,7 @@ var Result = /** @class */ (function () {
224216
aggregations: this.aggregations == null
225217
? null
226218
: this.aggregations.toArray(),
227-
suggests: this.suggests
219+
suggests: this.suggestions
228220
};
229221
if (this.subresults instanceof Object &&
230222
Object.keys(this.subresults).length) {
@@ -254,7 +246,7 @@ var Result = /** @class */ (function () {
254246
? ResultAggregations_1.ResultAggregations.createFromArray(array.aggregations)
255247
: null, array.suggests
256248
? array.suggests
257-
: null, array.items instanceof Array
249+
: [], array.items instanceof Array
258250
? array.items.map(function (itemAsArray) { return Item_1.Item.createFromArray(itemAsArray); })
259251
: []);
260252
/**

package-lock.json

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

0 commit comments

Comments
 (0)