File tree Expand file tree Collapse file tree 1 file changed +28
-10
lines changed
Expand file tree Collapse file tree 1 file changed +28
-10
lines changed Original file line number Diff line number Diff line change @@ -219,6 +219,7 @@ const getSortParams = () => {
219219
220220// [ํต์ฌ ์ ๋ ฌ ๋ก์ง]
221221const commonSort = [
222+ // 1๏ธโฃ ๊ทธ๋ฃน ๋ถ๋ฅ
222223 {
223224 _script : {
224225 type : "number" ,
@@ -229,25 +230,42 @@ const commonSort = [
229230
230231 long end = doc['end_date'].value.toInstant().toEpochMilli();
231232
232- // ์ด๋ฏธ ๋ง๊ฐ
233- if (end < params.now) return 3;
234-
235- // ์ค๋(KST) ๋ง๊ฐ
236- if (end >= params.dayStart && end <= params.dayEnd) return 0;
237-
238- // ๋ฏธ๋ ๋ง๊ฐ
239- return 1;
233+ if (end < params.now) return 3; // ๋ง๊ฐ
234+ if (end >= params.dayStart && end <= params.dayEnd) return 0; // ์ค๋ ๋ง๊ฐ
235+ return 1; // ๋ฏธ๋
240236 ` ,
241237 params : getSortParams ( )
242238 } ,
243239 order : "asc"
244240 }
245241 } ,
242+
243+ // 2๏ธโฃ ์ค๋ ๋ง๊ฐ์ธ ๊ฒฝ์ฐ๋ง end_date ๊ธฐ์ค (๊ทธ ์ธ๋ ํฐ ๊ฐ์ผ๋ก ๋ฐ์ด๋ฒ๋ฆผ)
246244 {
247- "end_date" : { "order" : "asc" , "missing" : "_last" }
245+ _script : {
246+ type : "number" ,
247+ script : {
248+ lang : "painless" ,
249+ source : `
250+ if (doc['end_date'].size() == 0) return 999999999999L;
251+
252+ long end = doc['end_date'].value.toInstant().toEpochMilli();
253+
254+ // ์ค๋ ๋ง๊ฐ ๊ทธ๋ฃน๋ง ์ค์ end_date ์ฌ์ฉ
255+ if (end >= params.dayStart && end <= params.dayEnd) {
256+ return end;
257+ }
258+
259+ // ๋๋จธ์ง๋ ๋์ผํ ๊ฐ์ผ๋ก ์ฒ๋ฆฌ โ ๋ค์ ์ ๋ ฌ(created_at)๋ก ๋์ด๊ฐ
260+ return 999999999999L;
261+ ` ,
262+ params : getSortParams ( )
263+ } ,
264+ order : "asc"
265+ }
248266 } ,
249267
250- // ๐น 2์์: ๊ฐ ๊ทธ๋ฃน ์์์ ์ต์ ๋ฑ๋ก์
268+ // 3๏ธโฃ ์ต์ข
: ๋ฑ๋ก ์ต์ ์ (์ค๋ ์ ์ธํ ์ ๋ถ ์ฌ๊ธฐ์ ์ํฅ)
251269 {
252270 "created_at" : { "order" : "desc" , "missing" : "_last" }
253271 }
You canโt perform that action at this time.
0 commit comments