98891: Make it possible to provide query to SearchComponent

This commit is contained in:
Alexandre Vryghem
2023-01-31 14:21:36 +01:00
parent e4f483c308
commit fbeaec1a54

View File

@@ -134,6 +134,11 @@ export class SearchComponent implements OnInit {
*/ */
@Input() viewModeList: ViewMode[]; @Input() viewModeList: ViewMode[];
/**
* The search query
*/
@Input() query: string;
/** /**
* The current configuration used during the search * The current configuration used during the search
*/ */
@@ -275,6 +280,9 @@ export class SearchComponent implements OnInit {
configuration: searchOptions.configuration || configuration, configuration: searchOptions.configuration || configuration,
sort: sortOption || searchOptions.sort sort: sortOption || searchOptions.sort
}); });
if (combinedOptions.query === '') {
combinedOptions.query = this.query;
}
const newSearchOptions = new PaginatedSearchOptions(combinedOptions); const newSearchOptions = new PaginatedSearchOptions(combinedOptions);
// check if search options are changed // check if search options are changed
// if so retrieve new related results otherwise skip it // if so retrieve new related results otherwise skip it