Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/app/core/data/search-response-parsing.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export class SearchResponseParsingService extends DspaceRestResponseParsingServi
payload.sort = data.payload.sort;
payload.scope = data.payload.scope;
payload.configuration = data.payload.configuration;
payload.spellCheckSuggestions = data.payload.spellCheckSuggestions;
const hitHighlights: MetadataMap[] = payload._embedded.objects
.map((object) => object.hitHighlights)
.map((hhObject) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,10 @@ export abstract class SearchQueryResponse<T> extends PaginatedList<T> {

@autoserialize
facets: any; // TODO

/**
* Spellcheck suggestions from the search backend
*/
@autoserialize
spellCheckSuggestions: string[];
}
14 changes: 14 additions & 0 deletions src/app/shared/search/search-results/search-results.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,20 @@ <h1>{{ (configuration ? configuration + '.search.results.head' : 'search.results
<ds-search-export-csv [searchConfig]="searchConfig" [total]="searchResults?.payload?.totalElements"></ds-search-export-csv>
}
</div>
@if (spellCheckSuggestions?.length > 0) {
<div class="spellcheck-suggestion mb-2 h3 mt-3">
{{ 'search.results.did-you-mean' | translate }}
@for (suggestion of spellCheckSuggestions; track suggestion; let last = $last) {
<a [routerLink]="['/search']"
[queryParams]="{ query: suggestion }"
queryParamsHandling="merge"
role="link"
tabindex="0">
{{ suggestion }}
</a>{{ last ? '' : ', ' }}
}
</div>
}
@if (searchResults && searchResults?.hasSucceeded && !searchResults?.isLoading && searchResults?.payload?.page.length > 0) {
<div @fadeIn>
<ds-viewable-collection
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,11 @@ export class SearchResultsComponent {
*/
@Input() configuration: string;

/**
* Spellcheck suggestions from the search backend
*/
@Input() spellCheckSuggestions: string[];

/**
* Whether or not to hide the header of the results
* Defaults to a visible header
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import {
})
export class ThemedSearchResultsComponent extends ThemedComponent<SearchResultsComponent> {

protected inAndOutputNames: (keyof SearchResultsComponent & keyof this)[] = ['linkType', 'searchResults', 'searchConfig', 'showCsvExport', 'showThumbnails', 'sortConfig', 'viewMode', 'configuration', 'disableHeader', 'selectable', 'context', 'hidePaginationDetail', 'selectionConfig', 'contentChange', 'deselectObject', 'selectObject'];
protected inAndOutputNames: (keyof SearchResultsComponent & keyof this)[] = ['linkType', 'searchResults', 'searchConfig', 'showCsvExport', 'showThumbnails', 'sortConfig', 'viewMode', 'configuration', 'disableHeader', 'selectable', 'context', 'hidePaginationDetail', 'selectionConfig', 'contentChange', 'deselectObject', 'selectObject', 'spellCheckSuggestions'];

@Input() linkType: CollectionElementLinkType;

Expand All @@ -42,6 +42,8 @@ export class ThemedSearchResultsComponent extends ThemedComponent<SearchResultsC

@Input() showThumbnails: boolean;

@Input() spellCheckSuggestions: string[];

@Input() sortConfig: SortOptions;

@Input() viewMode: ViewMode;
Expand Down
1 change: 1 addition & 0 deletions src/app/shared/search/search.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
@if (inPlaceSearch) {
<ds-search-results
[searchResults]="resultsRD$ | async"
[spellCheckSuggestions]="(resultsRD$ | async)?.payload?.spellCheckSuggestions"
[searchConfig]="searchOptions$ | async"
[configuration]="(currentConfiguration$ | async)"
[disableHeader]="!searchEnabled"
Expand Down
2 changes: 2 additions & 0 deletions src/assets/i18n/en.json5
Original file line number Diff line number Diff line change
Expand Up @@ -5158,6 +5158,8 @@

"search.results.head": "Search Results",

"search.results.did-you-mean": "Did you mean?",

"search.results.no-results": "Your search returned no results. Having trouble finding what you're looking for? Try putting",

"search.results.no-results-link": "quotes around it",
Expand Down
4 changes: 3 additions & 1 deletion src/assets/i18n/it.json5
Original file line number Diff line number Diff line change
Expand Up @@ -8524,7 +8524,9 @@
// "search.results.head": "Search Results",
"search.results.head": "Risultati della ricerca",

// "search.results.no-results": "Your search returned no results. Having trouble finding what you're looking for? Try putting",
// "search.results.did-you-mean": "Did you mean?",
"search.results.did-you-mean": "Intendevi?",

"search.results.no-results": "La ricerca non ha prodotto alcun risultato. Hai problemi a trovare quello che cerchi? Prova a inserire",

// "search.results.no-results-link": "quotes around it",
Expand Down
Loading