2021-11-12 10:13:22 +01:00
|
|
|
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<Dataset>;
|
|
|
|
}
|
|
|
|
|
|
|
|
export class FacetResults {
|
2021-11-19 16:11:26 +01:00
|
|
|
// language!: Array<FacetItem>;
|
|
|
|
// subject!: Array<FacetItem>;
|
|
|
|
[key: string]: Array<FacetItem>;
|
2021-11-12 10:13:22 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
export class FacetFields {
|
|
|
|
// count: number;
|
|
|
|
language!: FacetInstance;
|
|
|
|
subject!: FacetInstance;
|
|
|
|
// [key: string]: FacetInstance;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface FacetInstance {
|
|
|
|
[key: string]: Array<FacetItem>;
|
|
|
|
// buckets: Array<FacetItem>;
|
|
|
|
}
|
|
|
|
|
2021-11-12 15:49:27 +01:00
|
|
|
export class FacetItem {
|
2021-11-12 10:13:22 +01:00
|
|
|
val: string;
|
|
|
|
count: number;
|
|
|
|
category: string;
|
|
|
|
active: boolean;
|
2021-11-12 15:49:27 +01:00
|
|
|
|
|
|
|
constructor(value: string, count: number) {
|
|
|
|
this.val = value;
|
|
|
|
this.count = count;
|
|
|
|
this.active = false;
|
|
|
|
this.category = "";
|
|
|
|
}
|
2021-11-12 10:13:22 +01:00
|
|
|
}
|
2021-11-19 16:11:26 +01:00
|
|
|
//#endregion
|
2024-06-06 17:11:54 +02:00
|
|
|
|
|
|
|
// 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<Hit>;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface Total {
|
|
|
|
value: number;
|
|
|
|
relation: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface Hit {
|
|
|
|
_index: string;
|
|
|
|
_id: string;
|
|
|
|
_score: number;
|
|
|
|
_source: Dataset;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface Aggregations {
|
|
|
|
[key: string]: Aggregation;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface Aggregation {
|
|
|
|
buckets: Array<Bucket>;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface Bucket {
|
|
|
|
key: string;
|
|
|
|
doc_count: number;
|
|
|
|
}
|