Skip to content

Commit 7241294

Browse files
authored
Merge pull request #37 from apisearch-io/feature/refactored-sortby-model
Using new sortby format
2 parents 828e7e5 + eecb46c commit 7241294

File tree

8 files changed

+264
-291
lines changed

8 files changed

+264
-291
lines changed

dist/apisearch.js

+63-70
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/apisearch.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/apisearch.min.js

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/apisearch.min.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/Query/SortBy.d.ts

+30-31
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
/**
22
export * Sort by constants
33
*/
4-
export declare const SORT_BY_TYPE_FIELD = 1;
5-
export declare const SORT_BY_TYPE_NESTED = 2;
4+
export declare const SORT_BY_TYPE_FIELD = "field";
5+
export declare const SORT_BY_TYPE_NESTED = "nested";
6+
export declare const SORT_BY_TYPE_SCORE = "score";
7+
export declare const SORT_BY_TYPE_DISTANCE = "distance";
8+
export declare const SORT_BY_TYPE_FUNCTION = "function";
9+
export declare const SORT_BY_TYPE_RANDOM = "random";
610
export declare const SORT_BY_ASC = "asc";
711
export declare const SORT_BY_DESC = "desc";
812
export declare const SORT_BY_MODE_AVG = "avg";
@@ -11,51 +15,37 @@ export declare const SORT_BY_MODE_MIN = "min";
1115
export declare const SORT_BY_MODE_MAX = "max";
1216
export declare const SORT_BY_MODE_MEDIAN = "median";
1317
export declare const SORT_BY_SCORE: {
14-
_score: {
15-
order: string;
16-
};
18+
type: string;
1719
};
1820
export declare const SORT_BY_RANDOM: {
19-
random: {
20-
order: string;
21-
};
21+
type: string;
2222
};
2323
export declare const SORT_BY_AL_TUN_TUN: {
24-
random: {
25-
order: string;
26-
};
24+
type: string;
2725
};
2826
export declare const SORT_BY_ID_ASC: {
29-
"uuid.id": {
30-
order: string;
31-
};
27+
field: string;
28+
order: string;
3229
};
3330
export declare const SORT_BY_ID_DESC: {
34-
"uuid.id": {
35-
order: string;
36-
};
31+
field: string;
32+
order: string;
3733
};
3834
export declare const SORT_BY_TYPE_ASC: {
39-
"uuid.type": {
40-
order: string;
41-
};
35+
field: string;
36+
order: string;
4237
};
4338
export declare const SORT_BY_TYPE_DESC: {
44-
"uuid.type": {
45-
order: string;
46-
};
39+
field: string;
40+
order: string;
4741
};
4842
export declare const SORT_BY_LOCATION_KM_ASC: {
49-
_geo_distance: {
50-
order: string;
51-
unit: string;
52-
};
43+
type: string;
44+
unit: string;
5345
};
5446
export declare const SORT_BY_LOCATION_MI_ASC: {
55-
_geo_distance: {
56-
order: string;
57-
unit: string;
58-
};
47+
type: string;
48+
unit: string;
5949
};
6050
import { Coordinate } from "../Model/Coordinate";
6151
import { Filter } from "./Filter";
@@ -122,6 +112,15 @@ export declare class SortBy {
122112
* @return {SortBy}
123113
*/
124114
byNestedFieldAndFilter(field: string, order: string, filter: Filter, mode?: string): SortBy;
115+
/**
116+
* Sort by function
117+
*
118+
* @param func
119+
* @param order
120+
*
121+
* @return {SortBy}
122+
*/
123+
byFunction(func: string, order: string): SortBy;
125124
/**
126125
* Is sorted by geo distance
127126
*

0 commit comments

Comments
 (0)