lemon-model 1.0.5 → 1.0.6

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/README.md CHANGED
@@ -4,9 +4,10 @@ Common shared model definitions for both `backend` and `frontend`.
4
4
 
5
5
  ## Usage
6
6
 
7
- To develop backend-api, use [lemon-core](https://github.com/lemoncloud-io/lemon-core) instead of this.
7
+ !TIP! to develop `backend` api, use [lemon-core](https://github.com/lemoncloud-io/lemon-core) instead of this.
8
8
 
9
9
  ```sh
10
+ # install with npm
10
11
  npm install --save lemon-model
11
12
  ```
12
13
 
@@ -22,10 +23,11 @@ See [CODE_OF_CONDUCT](CODE_OF_CONDUCT.md)
22
23
 
23
24
  ----------------
24
25
 
25
- # VERSION INFO
26
+ ## VERSION INFO
26
27
 
27
28
  | Version | Description
28
29
  |-- |--
30
+ | 1.0.6 | optimized `SearchBody` with `knn` support.
29
31
  | 1.0.5 | optimized `NextIdentity` with `authorization`.
30
32
  | 1.0.4 | optimized `NextIdentity` with `referer` and `origin`.
31
33
  | 1.0.3 | optimized `NextIdentityCognito`
@@ -9,6 +9,7 @@
9
9
  * @date 2021-12-07 support SearchBody
10
10
  * @date 2024-12-20 optimized `NextIdentityCognito`
11
11
  * @date 2025-05-13 optimized `NextContext` with `Authorization` header
12
+ * @date 2025-06-12 optimized `SearchBody` with `knn` support
12
13
  *
13
14
  * @copyright (C) lemoncloud.io 2019 - All Rights Reserved.
14
15
  */
@@ -295,7 +296,9 @@ export interface QueryResult<T> {
295
296
  last?: any;
296
297
  }
297
298
  /**
298
- * 쿼리의 각 항목의 값들
299
+ * type: `QueryTerm`
300
+ * - query term for search.
301
+ * - it should be compartible with elastic-search.
299
302
  */
300
303
  export declare type QueryTerm = string | number | string[] | number[] | {
301
304
  query: string | number | string[] | number[];
@@ -310,7 +313,9 @@ export declare type QueryTerm = string | number | string[] | number[] | {
310
313
  };
311
314
  };
312
315
  /**
313
- * 정렬(sort)에 쓰이는 항목.
316
+ * type: `SortTerm`
317
+ * - sort term for search.
318
+ * - it should be compartible with elastic-search.
314
319
  */
315
320
  export declare type SortTerm = string | {
316
321
  [key: string]: 'asc' | 'desc';
@@ -321,7 +326,9 @@ export declare type SortTerm = string | {
321
326
  };
322
327
  };
323
328
  /**
324
- * 검색 쿼리 항목.
329
+ * type: `SearchQuery`
330
+ * - search query for elastic-search.
331
+ * - it should be compartible with elastic-search.
325
332
  */
326
333
  export interface SearchQuery {
327
334
  term?: {
@@ -358,6 +365,26 @@ export interface SearchQuery {
358
365
  should?: SearchQuery | SearchQuery[];
359
366
  minimum_should_match?: number;
360
367
  };
368
+ /** required to have mapping type: `knn_vector` */
369
+ knn?: {
370
+ /** field (ex: `vector$.sm3`) to query */
371
+ [field: string]: {
372
+ vector: number[];
373
+ /** The number of nearest neighbors to return */
374
+ k?: number;
375
+ max_distance?: number;
376
+ min_score?: number;
377
+ filter?: SearchQuery;
378
+ method_parameters?: {
379
+ ef_search?: number;
380
+ nprobes?: number;
381
+ };
382
+ rescore?: {
383
+ oversample_factor?: number;
384
+ } | boolean;
385
+ expand_nested_docs?: boolean;
386
+ };
387
+ };
361
388
  query_string?: {
362
389
  query: string;
363
390
  };
@@ -10,6 +10,7 @@
10
10
  * @date 2021-12-07 support SearchBody
11
11
  * @date 2024-12-20 optimized `NextIdentityCognito`
12
12
  * @date 2025-05-13 optimized `NextContext` with `Authorization` header
13
+ * @date 2025-06-12 optimized `SearchBody` with `knn` support
13
14
  *
14
15
  * @copyright (C) lemoncloud.io 2019 - All Rights Reserved.
15
16
  */
@@ -1 +1 @@
1
- {"version":3,"file":"core-types.js","sourceRoot":"","sources":["../../src/types/core-types.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG"}
1
+ {"version":3,"file":"core-types.js","sourceRoot":"","sources":["../../src/types/core-types.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lemon-model",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "description": "Common shared model definitions for Lemon Micro-Service Platform",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",