Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
nomad-lab
encyclopedia-gui
Commits
b006a38b
Commit
b006a38b
authored
Feb 01, 2021
by
Lauri Himanen
Browse files
Changed the behaviour of the formula search from CONTAINS to HAS ANY/HAS ONLY.
parent
f2fdfd25
Pipeline
#92575
skipped with stage
Changes
3
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
client/bundle.js
View file @
b006a38b
This diff is collapsed.
Click to expand it.
client/conf.js
View file @
b006a38b
window
.
nomadEnv
=
{
apiRoot
:
"
https://nomad-lab.eu/dev/nomad/enc-search/api/encyclopedia/
"
,
//
apiRoot: "https://nomad-lab.eu/dev/nomad/enc-search/api/encyclopedia/",
//apiRoot: "https://nomad-lab.eu/prod/rae/api/encyclopedia/",
//
apiRoot: "http://localhost:8000/fairdi/nomad/latest/api/encyclopedia/",
apiRoot
:
"
http://localhost:8000/fairdi/nomad/latest/api/encyclopedia/
"
,
keycloakBase
:
'
https://nomad-lab.eu/fairdi/keycloak/auth/
'
,
keycloakRealm
:
'
fairdi_nomad_test
'
,
keycloakClientId
:
'
nomad_gui_dev
'
...
...
client/src/search-mod/SearchBox.view.js
View file @
b006a38b
...
...
@@ -161,7 +161,7 @@ class SearchBox{
}
else
{
// Formula
let
formula
=
new
Formula
(
item
);
optimadeQuery
+=
formula
.
getOptimade
Inclusive
Subquery
();
// optimadeQuery += ` formula="${this.searchQuery[i]}"`
optimadeQuery
+=
formula
.
getOptimadeSubquery
(
allowOtherElements
);
// optimadeQuery += ` formula="${this.searchQuery[i]}"`
}
});
...
...
@@ -169,7 +169,9 @@ class SearchBox{
// if (subquery.length === 1 && !isElement(subquery[0])){ // Only one formula
if
(
!
isElement
(
subquery
[
0
])){
// formula(s)
optimadeQuery
+=
`formula="
${
subquery
[
0
]}
"`
;
//optimadeQuery += `formula="${subquery[0]}"`;
let
formula
=
new
Formula
(
subquery
[
0
]);
optimadeQuery
+=
formula
.
getOptimadeSubquery
(
allowOtherElements
);
}
else
{
// Several items, they all should be elements
optimadeQuery
+=
getOptimadeExclusiveANDSubquery
(
subquery
);
...
...
@@ -412,25 +414,16 @@ class Formula{
return
map
;
}
getOptimadeInclusiveSubquery
(){
let
optSubquery
=
''
;
let
first
=
true
;
getOptimadeSubquery
(
allowOtherElements
)
{
const
fragments
=
[]
this
.
formulaMap
.
forEach
(
(
number
,
element
)
=>
{
console
.
log
(
element
,
number
);
if
(
first
)
first
=
false
;
else
optSubquery
+=
'
AND
'
;
let
token
=
element
+
(
number
===
1
?
''
:
+
number
);
optSubquery
+=
`formula CONTAINS "
${
token
}
"`
;
});
return
optSubquery
;
const
fragment
=
'
"
'
+
element
+
(
number
===
1
?
''
:
+
number
)
+
'
"
'
;
fragments
.
push
(
fragment
)
})
return
'
formula HAS
'
+
(
allowOtherElements
?
'
ANY
'
:
'
ONLY
'
)
+
fragments
.
join
(
'
,
'
)
}
/*
getReducedFormula(getTokens = true){
let counter = 0;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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