import { Dataset } from "./dataset"; export interface SolrResponse { responseHeader: ResponseHeader; response: ResponseContent; facets: FacetFields; // facet_counts: FacetCount; } export interface ResponseHeader { status: boolean; QTime: number; params: ResponseHeaderParams; } export interface ResponseHeaderParams { defType: string; rows?: number; start?: number; wt?: string; // 0:'fl=id,licence,server_date_published,abstract_output,identifier,title_output,title_additional,author,subject,doctype' // df:'title' // facet:'on' // indent:'on' // json.facet.language:'{ type: "terms", field: "language" }' // json.facet.subject:'{ type: "terms", field: "subject" }' // q:'title:Geodaten - Blatt 49 Wels (1:50.000)' // q.op:'and' // rows:'10' // start:'0' // wt:'json' } export interface ResponseContent { numFound: number; start: number; docs: Array; } export class FacetResults { // language!: Array; // subject!: Array; [key: string]: Array; } export class FacetFields { // count: number; language!: FacetInstance; subject!: FacetInstance; // [key: string]: FacetInstance; } export interface FacetInstance { [key: string]: Array; // buckets: Array; } export class FacetItem { val: string; count: number; category: string; active: boolean; constructor(value: string, count: number) { this.val = value; this.count = count; this.active = false; this.category = ""; } } //#endregion // OPENSEARCH // ======================================================================== export interface OpenSearchResponse { took: number; timed_out: boolean; _shards: Shards; hits: Hits; aggregations?: Aggregations; } export interface Shards { total: number; successful: number; skipped: number; failed: number; } export interface Hits { total: Total; max_score: number; hits: Array; } export interface Total { value: number; relation: string; } export interface Hit { _index: string; _id: string; _score: number; _source: Dataset; _highlight: HitHighlight; // !! This name is to avoid collision with Typescript "Highlight" class } export interface HitHighlight { subjects?: Array; title?: Array; author?: Array; } export interface Aggregations { subjects: Subjects; language: Language; } export interface Subjects { doc_count_error_upper_bound: number; sum_other_doc_count: number; buckets: Array; } export interface Language { doc_count_error_upper_bound: number; sum_other_doc_count: number; buckets: Array; } export interface Bucket { key: string; doc_count: number; } // // Needed? // export interface Aggregations { // [key: string]: Aggregation; // } // export interface Aggregation { // buckets: Array; // }