UNPKG

@knora/viewer

Version:
80 lines (79 loc) 2.91 kB
import { OnChanges, OnInit } from '@angular/core'; import { PageEvent } from '@angular/material'; import { ActivatedRoute, Router } from '@angular/router'; import { ApiResponseError, IResourceClassAndPropertyDefinitions, KnoraApiConnection, ReadResource } from '@knora/api'; import { ExtendedSearchParams, SearchParamsService } from '@knora/core'; /** * The search-results gets the search mode and parameters from routes or inputs, * and returns the corresponding resources that are displayed in a list or a grid. * The results can be filtered by project. */ export declare class SearchResultsComponent implements OnInit, OnChanges { private knoraApiConnection; private _route; private _searchParamsService; private _router; /** * @param {boolean} [complexView] If true it shows 3 ways to display the search results: list or grid or table * */ complexView?: boolean; /** * @param [viewAs] Show result as list, grid or tabel. Default value is list */ viewAs?: 'list' | 'grid' | 'table'; /** * @param {string} [searchQuery] Search parameters. It can be a gravsearch query (extended mode) or string (fulltext mode). */ searchQuery?: string; /** * @param {string} [searchMode] Search mode: Extended or fulltext. */ searchMode?: string; /** * @param {string} [projectIri] Project Iri. To filter the results by project. */ projectIri?: string; pageEvent: PageEvent; initSearch: boolean; gravSearchQuery: string; gravsearchGenerator: ExtendedSearchParams; result: ReadResource[]; ontologyInfo: IResourceClassAndPropertyDefinitions; numberOfAllResults: number; badRequest: boolean; loading: boolean; errorMessage: ApiResponseError; pagingLimit: number; constructor(knoraApiConnection: KnoraApiConnection, _route: ActivatedRoute, _searchParamsService: SearchParamsService, _router: Router); ngOnInit(): void; ngOnChanges(): void; resetPage(): void; /** * Generates the Gravsearch query for the current offset. * @ignore */ private generateGravsearchQuery; /** * Get search result from Knora - 2 cases: simple search and extended search * @ignore */ private getResult; /** * Converts search results from JSON-LD to a [[ReadResourcesSequence]] and requests information about ontology entities. * This function is passed to `subscribe` as a pointer (instead of redundantly defining the same lambda function). * @ignore * * @param {ReadResourcesSequence} searchResult the answer to a search request. */ private processSearchResults; /** * Loads the next page of results. * The results will be appended to the existing ones. * @ignore * * @param {number} offset * @returns void */ loadMore(page: PageEvent): void; }