Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
DLCM
UI
DLCM-Portal
Commits
5b5ba414
Commit
5b5ba414
authored
Dec 22, 2021
by
Florent Poittevin
Browse files
fix(archive search): [DLCM-2003] facetted search with multiple values on same field cause error
parent
f66c64cb
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/app/features/home/helpers/home.helper.ts
View file @
5b5ba414
...
...
@@ -10,6 +10,7 @@ import {RoutesEnum} from "@shared/enums/routes.enum";
import
{
ViewModeTableEnum
}
from
"
@shared/enums/view-mode-table.enum
"
;
import
{
Observable
}
from
"
rxjs
"
;
import
{
isEmptyArray
,
isNonEmptyString
,
isNotNullNorUndefined
,
isNullOrUndefined
,
...
...
@@ -101,13 +102,21 @@ export class HomeHelper {
static
getFacetsSelectedForBackend
(
facetsSelected
:
MappingObject
<
string
[]
>
):
SearchFacet
[]
{
const
facetsSelectedForBackend
:
SearchFacet
[]
=
[];
MappingObjectUtil
.
forEach
(
facetsSelected
,
(
value
,
key
)
=>
{
if
(
isNullOrUndefined
(
value
)
||
isEmptyArray
(
value
))
{
return
;
}
if
(
this
.
LIST_FACET_USE_OPERATOR_AND
.
indexOf
(
key
as
Enums
.
Facet
.
Name
)
===
-
1
)
{
// FOR OR, equal value = [ "orgUnitName1", "orgUnitName2" ]
facetsSelectedForBackend
.
push
(
{
const
facet
=
{
field
:
key
,
type
:
undefined
,
equalValue
:
value
.
length
===
1
?
value
[
0
]
:
value
,
});
}
as
SearchFacet
;
if
(
value
.
length
===
1
)
{
facet
.
equalValue
=
value
[
0
];
}
else
{
facet
.
equalValues
=
value
;
}
facetsSelectedForBackend
.
push
(
facet
);
}
else
{
// FOR AND, equal value = "orgUnitName1", need to create a second search facet with "orgUnitName2"
value
.
forEach
(
v
=>
{
...
...
src/app/models/index.ts
View file @
5b5ba414
...
...
@@ -336,7 +336,8 @@ export interface User extends UserPartial, BaseResource, UserInfo {
export
interface
SearchFacet
{
field
:
string
;
equalValue
:
string
|
string
[];
equalValue
?:
string
;
equalValues
?:
string
[];
type
:
undefined
|
"
NOT_MATCH
"
;
}
...
...
Florent Poittevin
@Florent.Poittevin
mentioned in commit
3be9ad61
·
Dec 22, 2021
mentioned in commit
3be9ad61
mentioned in commit 3be9ad613dc47d9552f69835b6da1b994f113bd3
Toggle commit list
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