@mframework/layer-search 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app/types/adapter.ts +6 -0
- package/app/types/facet.ts +9 -0
- package/app/types/opensearch.ts +19 -0
- package/app/types/query.ts +19 -0
- package/app/types/result.ts +18 -0
- package/package.json +1 -1
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface OpenSearchHit<T = unknown> {
|
|
2
|
+
_source: T
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
export interface OpenSearchHits<T = unknown> {
|
|
6
|
+
total: { value: number }
|
|
7
|
+
hits: Array<OpenSearchHit<T>>
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface OpenSearchAggregations {
|
|
11
|
+
[key: string]: {
|
|
12
|
+
buckets: Array<{ key: string; doc_count: number }>
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface OpenSearchResponse<T = unknown> {
|
|
17
|
+
hits: OpenSearchHits<T>
|
|
18
|
+
aggregations?: OpenSearchAggregations
|
|
19
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface SearchFilter {
|
|
2
|
+
field: string
|
|
3
|
+
value: string | number | boolean
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export interface SortOption {
|
|
7
|
+
field: string
|
|
8
|
+
direction: 'asc' | 'desc'
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface SearchQuery {
|
|
12
|
+
q: string
|
|
13
|
+
filters?: SearchFilter[]
|
|
14
|
+
sort?: SortOption[]
|
|
15
|
+
page?: number
|
|
16
|
+
limit?: number
|
|
17
|
+
offset?: number
|
|
18
|
+
pageSize?: number
|
|
19
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface SearchResultItem {
|
|
2
|
+
id: string
|
|
3
|
+
type: 'product' | 'category' | 'content' | string
|
|
4
|
+
title: string
|
|
5
|
+
description?: string
|
|
6
|
+
image?: string
|
|
7
|
+
url?: string
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface SearchResultBase {
|
|
11
|
+
items: SearchResultItem[]
|
|
12
|
+
total: number
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export type SearchResult<T = SearchResultItem> = {
|
|
16
|
+
items: T[]
|
|
17
|
+
total: number
|
|
18
|
+
}
|