diff --git a/src/app/+search-page/search-labels/search-labels.component.ts b/src/app/+search-page/search-labels/search-labels.component.ts index e0dac304d1..7d8b8fbd7a 100644 --- a/src/app/+search-page/search-labels/search-labels.component.ts +++ b/src/app/+search-page/search-labels/search-labels.component.ts @@ -11,13 +11,28 @@ import { hasValue, isNotEmpty } from '../../shared/empty.util'; templateUrl: './search-labels.component.html', }) +/** + * Component that represents the labels containing the currently active filters + */ export class SearchLabelsComponent { + /** + * Emits the currently active filters + */ appliedFilters: Observable; + /** + * Initialize the instance variable + */ constructor(private searchService: SearchService, private filterService: SearchFilterService) { this.appliedFilters = this.filterService.getCurrentFrontendFilters(); } + /** + * Calculates the parameters that should change if a given value for the given filter would be removed from the active filters + * @param {string} filterField The filter field parameter name from which the value should be removed + * @param {string} filterValue The value that is removed for this given filter field + * @returns {Observable} The changed filter parameters + */ getRemoveParams(filterField: string, filterValue: string): Observable { return this.appliedFilters.pipe( map((filters) => { @@ -31,6 +46,9 @@ export class SearchLabelsComponent { ) } + /** + * @returns {string} The base path to the search page + */ getSearchLink() { return this.searchService.getSearchLink(); } diff --git a/src/app/+search-page/search-results/search-results.component.ts b/src/app/+search-page/search-results/search-results.component.ts index 14ccb5d541..cbb597419a 100644 --- a/src/app/+search-page/search-results/search-results.component.ts +++ b/src/app/+search-page/search-results/search-results.component.ts @@ -7,11 +7,6 @@ import { SortOptions } from '../../core/cache/models/sort-options.model'; import { SearchResult } from '../search-result.model'; import { PaginatedList } from '../../core/data/paginated-list'; -/** - * This component renders a simple item page. - * The route parameter 'id' is used to request the item it represents. - * All fields of the item that should be displayed, are defined in its template. - */ @Component({ selector: 'ds-search-results', templateUrl: './search-results.component.html', @@ -20,9 +15,28 @@ import { PaginatedList } from '../../core/data/paginated-list'; fadeInOut ] }) + +/** + * Component that represents all results from a search + */ export class SearchResultsComponent { + /** + * The actual search result objects + */ @Input() searchResults: RemoteData>>; + + /** + * The current configuration of the search + */ @Input() searchConfig: SearchOptions; + + /** + * The current sort options for the search + */ @Input() sortConfig: SortOptions; + + /** + * The current view mode for the search results + */ @Input() viewMode: ViewMode; } diff --git a/src/app/+search-page/search-service/facet-value.model.ts b/src/app/+search-page/search-service/facet-value.model.ts index 06eb50bc6b..a597528d50 100644 --- a/src/app/+search-page/search-service/facet-value.model.ts +++ b/src/app/+search-page/search-service/facet-value.model.ts @@ -1,13 +1,25 @@ import { autoserialize, autoserializeAs } from 'cerialize'; +/** + * Class representing possible values for a certain filter + */ export class FacetValue { + /** + * The display value of the facet value + */ @autoserializeAs(String, 'label') value: string; + /** + * The number of results this facet value would have if selected + */ @autoserialize count: number; + /** + * The REST url to add this filter value + */ @autoserialize search: string; } diff --git a/src/app/+search-page/search-service/filter-type.model.ts b/src/app/+search-page/search-service/filter-type.model.ts index 3c2966a778..d9b9629347 100644 --- a/src/app/+search-page/search-service/filter-type.model.ts +++ b/src/app/+search-page/search-service/filter-type.model.ts @@ -1,6 +1,24 @@ +/** + * Enumeration containing all possible types for filters + */ export enum FilterType { + /** + * Represents simple text facets + */ text = 'text', + + /** + * Represents date facets + */ range = 'date', + + /** + * Represents hierarchically structured facets + */ hierarchy = 'hierarchical', + + /** + * Represents binary facets + */ boolean = 'standard' } diff --git a/src/app/+search-page/search-service/search-filter-config.model.ts b/src/app/+search-page/search-service/search-filter-config.model.ts index ced1f7a8eb..edc461c463 100644 --- a/src/app/+search-page/search-service/search-filter-config.model.ts +++ b/src/app/+search-page/search-service/search-filter-config.model.ts @@ -1,6 +1,9 @@ import { FilterType } from './filter-type.model'; import { autoserialize, autoserializeAs } from 'cerialize'; + /** + * + */ export class SearchFilterConfig { @autoserialize @@ -12,15 +15,24 @@ @autoserialize hasFacets: boolean; - // @autoserializeAs(String, 'facetLimit') - uncomment when fixed in rest + @autoserializeAs(String, 'facetLimit') pageSize = 5; + /** + * Defines if the item facet is collapsed by default or not on the search page + */ @autoserialize isOpenByDefault: boolean; + /** + * Minimum value possible for this facet in the repository + */ @autoserialize maxValue: string; + /** + * Maximum value possible for this facet in the repository + */ @autoserialize minValue: string; /**