diff --git a/lib/content-services/src/lib/search/services/base-query-builder.service.ts b/lib/content-services/src/lib/search/services/base-query-builder.service.ts index 744f46782c2..6365efa12bc 100644 --- a/lib/content-services/src/lib/search/services/base-query-builder.service.ts +++ b/lib/content-services/src/lib/search/services/base-query-builder.service.ts @@ -15,17 +15,17 @@ * limitations under the License. */ -import { Subject, Observable, from, ReplaySubject, BehaviorSubject } from 'rxjs'; +import { BehaviorSubject, from, Observable, ReplaySubject, Subject } from 'rxjs'; import { AppConfigService } from '@alfresco/adf-core'; import { - SearchRequest, RequestFacetFields, - RequestSortDefinitionInner, - ResultSetPaging, RequestHighlight, RequestScope, + RequestSortDefinitionInner, + ResultSetPaging, + SEARCH_LANGUAGE, SearchApi, - SEARCH_LANGUAGE + SearchRequest } from '@alfresco/js-api'; import { SearchCategory } from '../models/search-category.interface'; import { FilterQuery } from '../models/filter-query.interface'; @@ -596,6 +596,7 @@ export abstract class BaseQueryBuilderService { * @param searchUrl search url to navigate to */ async navigateToSearch(query: string, searchUrl: string) { + this.update(); this.userQuery = query; await this.execute(); await this.router.navigate([searchUrl], { diff --git a/lib/content-services/src/lib/search/services/search-query-builder.service.spec.ts b/lib/content-services/src/lib/search/services/search-query-builder.service.spec.ts index 18aadf4d902..c700efff1fa 100644 --- a/lib/content-services/src/lib/search/services/search-query-builder.service.spec.ts +++ b/lib/content-services/src/lib/search/services/search-query-builder.service.spec.ts @@ -714,9 +714,11 @@ describe('SearchQueryBuilder', () => { it('should encode query from filter raw params and update query params on navigating to search', async () => { spyOn(router, 'navigate'); const builder = createQueryBuilder(); + spyOn(builder, 'update'); await builder.navigateToSearch('test query', '/search'); expect(builder.filterRawParams).toEqual({ userQuery: '(test query)' }); + expect(builder.update).toHaveBeenCalled(); expect(router.navigate).toHaveBeenCalledWith([], { relativeTo: activatedRoute, queryParams: { q: 'eyJ1c2VyUXVlcnkiOiIodGVzdCBxdWVyeSkifQ==' },