Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jio
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Romain Courteaud
jio
Commits
a2f84507
Commit
a2f84507
authored
Jul 03, 2024
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WIP query sort with null value
parent
397bd917
Pipeline
#35746
failed with stage
in 0 seconds
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
7 deletions
+17
-7
src/queries/query.js
src/queries/query.js
+6
-1
test/queries/tests.js
test/queries/tests.js
+11
-6
No files found.
src/queries/query.js
View file @
a2f84507
...
@@ -47,7 +47,10 @@
...
@@ -47,7 +47,10 @@
value
=
[
value
];
value
=
[
value
];
}
}
for
(
i
=
0
;
i
<
value
.
length
;
i
+=
1
)
{
for
(
i
=
0
;
i
<
value
.
length
;
i
+=
1
)
{
if
((
value
[
i
]
!==
null
)
&&
(
typeof
value
[
i
]
===
'
object
'
))
{
if
(
value
[
i
]
===
null
)
{
new_value
[
i
]
=
undefined
;
}
else
if
(
typeof
value
[
i
]
===
'
object
'
)
{
//if (typeof value[i] === 'object') {
new_value
[
i
]
=
value
[
i
].
content
;
new_value
[
i
]
=
value
[
i
].
content
;
}
else
{
}
else
{
new_value
[
i
]
=
value
[
i
];
new_value
[
i
]
=
value
[
i
];
...
@@ -119,8 +122,10 @@
...
@@ -119,8 +122,10 @@
}
}
// this comparison is 5 times faster than json comparison
// this comparison is 5 times faster than json comparison
console
.
log
(
a
[
key
],
b
[
key
]);
a_string_array
=
metadataValueToStringArray
(
a
[
key
])
||
[];
a_string_array
=
metadataValueToStringArray
(
a
[
key
])
||
[];
b_string_array
=
metadataValueToStringArray
(
b
[
key
])
||
[];
b_string_array
=
metadataValueToStringArray
(
b
[
key
])
||
[];
console
.
log
(
a_string_array
,
b_string_array
);
l
=
Math
.
max
(
a_string_array
.
length
,
b_string_array
.
length
);
l
=
Math
.
max
(
a_string_array
.
length
,
b_string_array
.
length
);
for
(
i
=
0
;
i
<
l
;
i
+=
1
)
{
for
(
i
=
0
;
i
<
l
;
i
+=
1
)
{
if
(
a_string_array
[
i
]
===
undefined
)
{
if
(
a_string_array
[
i
]
===
undefined
)
{
...
...
test/queries/tests.js
View file @
a2f84507
...
@@ -716,9 +716,11 @@
...
@@ -716,9 +716,11 @@
test
(
'
sort_on options do not raise in case of null value
'
,
function
()
{
test
(
'
sort_on options do not raise in case of null value
'
,
function
()
{
var
doc_list
=
[
var
doc_list
=
[
{
'
a
'
:
null
},
{
'
a
'
:
null
,
'
b
'
:
5
},
{
'
c
'
:
3
},
{
'
a
'
:
null
,
'
b
'
:
4
},
{
'
b
'
:
2
}
{
'
a
'
:
3
,
'
b
'
:
3
},
{
'
a
'
:
2
,
'
b
'
:
2
},
{
'
a
'
:
null
,
'
b
'
:
1
}
];
];
stop
();
stop
();
...
@@ -726,13 +728,16 @@
...
@@ -726,13 +728,16 @@
jIO
.
QueryFactory
.
create
(
""
).
exec
(
jIO
.
QueryFactory
.
create
(
""
).
exec
(
doc_list
,
doc_list
,
{
{
sort_on
:
[[
'
a
'
,
'
ascending
'
]],
sort_on
:
[
[
'
a
'
,
'
descending
'
],
[
'
b
'
,
'
ascending
'
],
],
}
}
)
)
.
then
(
function
(
list
)
{
.
then
(
function
(
list
)
{
deepEqual
(
list
,
[
deepEqual
(
list
,
[
{
'
c
'
:
3
},
{
'
a
'
:
3
},
{
'
b
'
:
2
},
{
'
a
'
:
2
},
{
'
a
'
:
null
}
{
'
a
'
:
null
}
],
'
Sorting didn
\'
t raise
'
);
],
'
Sorting didn
\'
t raise
'
);
}).
always
(
start
);
}).
always
(
start
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment