Skip to content

Commit

Permalink
Merge branch 'master' into autocomplete
Browse files Browse the repository at this point in the history
  • Loading branch information
joemcelroy committed May 9, 2022
2 parents 967201f + 5f97bf5 commit 1f7cfd3
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 13 deletions.
16 changes: 16 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,22 @@
"console": "integratedTerminal",
"sourceMaps": true
},
{
"name": "Jest app-search-connector",
"type": "node",
"request": "launch",
"program": "${workspaceRoot}/node_modules/jest/bin/jest.js",
"stopOnEntry": false,
"args": ["--runInBand", "--forceExit", "--detectOpenHandles", "--watch"],
"cwd": "${workspaceRoot}/packages/search-ui-app-search-connector",
"preLaunchTask": null,
"runtimeExecutable": null,
"env": {
"NODE_ENV": "test"
},
"console": "integratedTerminal",
"sourceMaps": true
},
{
"name": "Jest elasticsearch-connector",
"type": "node",
Expand Down
2 changes: 1 addition & 1 deletion packages/search-ui-app-search-connector/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"typescript": "^4.5.4"
},
"dependencies": {
"@elastic/app-search-javascript": "^8.1.1",
"@elastic/app-search-javascript": "^8.1.2",
"@elastic/search-ui": "1.11.3"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -215,12 +215,17 @@ class AppSearchAPIConnector implements APIConnector {
const options = removeEmptyFacetsAndFilters(withQueryConfigOptions);
promises.push(
this.beforeAutocompleteResultsCall(options, (newOptions) => {
return this.client.search(query, newOptions).then((response) => {
autocompletedState.autocompletedResults =
adaptResponse(response).results;
autocompletedState.autocompletedResultsRequestId =
response.info.meta.request_id;
});
return this.client
.search(query, {
...newOptions,
record_analytics: false
})
.then((response) => {
autocompletedState.autocompletedResults =
adaptResponse(response).results;
autocompletedState.autocompletedResultsRequestId =
response.info.meta.request_id;
});
})
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,8 @@ describe("AppSearchAPIConnector", () => {
const [passedSearchTerm, passedOptions] = getLastSearchCall();
expect(passedSearchTerm).toEqual(state.searchTerm);
expect(passedOptions).toEqual({
page: {}
page: {},
record_analytics: false
});
});

Expand All @@ -510,6 +511,7 @@ describe("AppSearchAPIConnector", () => {
const [passedSearchTerm, passedOptions] = getLastSearchCall();
expect(passedSearchTerm).toEqual(state.searchTerm);
expect(passedOptions).toEqual({
record_analytics: false,
page: {},
result_fields: {
title: { raw: {}, snippet: { size: 20, fallback: true } }
Expand Down Expand Up @@ -541,7 +543,8 @@ describe("AppSearchAPIConnector", () => {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const [passedSearchTerm, passedOptions] = getLastSearchCall();
expect(passedOptions).toEqual({
page: {}
page: {},
record_analytics: false
});
});

Expand Down Expand Up @@ -582,6 +585,7 @@ describe("AppSearchAPIConnector", () => {
}
]
},
record_analytics: false,
page: {
current: 2,
size: 5
Expand Down Expand Up @@ -693,6 +697,7 @@ describe("AppSearchAPIConnector", () => {
expect(getLastSearchCall()).toEqual([
state.searchTerm,
{
record_analytics: false,
page: {
size: 5
},
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1329,10 +1329,10 @@
dependencies:
postcss-value-parser "^4.2.0"

"@elastic/app-search-javascript@^8.1.1":
version "8.1.1"
resolved "https://registry.yarnpkg.com/@elastic/app-search-javascript/-/app-search-javascript-8.1.1.tgz#3b675f811c8a5621d264b021666a85500d8a7b19"
integrity sha512-rGa3/zxSzdRjlpzangFwdtierdIWHdEnWhjNPH9MshB70ibqaUKd61OS3/hXsE0ZYGLrJ8BrIEhpshjIXI4Dbw==
"@elastic/app-search-javascript@^8.1.2":
version "8.1.2"
resolved "https://registry.yarnpkg.com/@elastic/app-search-javascript/-/app-search-javascript-8.1.2.tgz#8b60d74deab05b6e8603078c013d75cbd41c2f80"
integrity sha512-o3S3GrwaKhZWedLDrPpyHwAhidovTqG0oEz0+f1Hk4mDLmnlViPBIJhg12KuCuM0MYFUavKDHoqARlsbW8z6Kw==
dependencies:
object-hash "^1.3.0"

Expand Down

0 comments on commit 1f7cfd3

Please sign in to comment.