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
e8d7351a
Commit
e8d7351a
authored
Feb 12, 2021
by
Lauri Himanen
Browse files
Added support for formula search for the new query optimade translation function.
parent
5714d658
Pipeline
#93389
skipped with stage
Changes
2
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
client/bundle.js
View file @
e8d7351a
This diff is collapsed.
Click to expand it.
client/src/search-mod/SearchBox.view.js
View file @
e8d7351a
...
...
@@ -85,7 +85,7 @@ class SearchBox{
let
query
=
[...
this
.
searchQuery
];
let
types
=
[...
this
.
queryTypes
];
// For combining elements/formul
e
s connected by AND into a single list
// For combining elements/formul
a
s connected by AND into a single list
function
combineANDIn
(
query
,
types
)
{
const
newQuery
=
[]
const
newTypes
=
[]
...
...
@@ -99,27 +99,23 @@ class SearchBox{
const
q3
=
query
[
i
+
2
];
const
t3
=
types
[
i
+
2
];
if
(
q2
===
"
AND
"
&&
q0
!==
"
NOT
"
)
{
if
(
((
t1
===
"
E
"
||
t1
===
"
EL
"
)
&&
(
t3
===
"
E
"
||
t3
===
"
EL
"
))
||
((
t1
===
"
F
"
&&
t3
===
"
F
"
)
)
{
let
active
=
true
let
joined
=
[
q1
,
q3
]
i
=
i
+
3
while
(
active
)
{
const
q4
=
query
[
i
];
const
t4
=
types
[
i
];
const
q5
=
query
[
i
+
1
];
const
t5
=
types
[
i
+
1
];
if
(
q4
===
"
AND
"
&&
(
t5
===
"
E
"
||
t5
===
"
EL
"
))
{
joined
.
push
(
q5
)
i
+=
2
}
else
{
active
=
false
newQuery
.
push
(
joined
.
join
(
"
,
"
))
newTypes
.
push
(
"
EL
"
)
}
if
(((
t1
===
"
E
"
&&
t3
===
"
E
"
)
||
(
t1
===
"
F
"
&&
t3
===
"
F
"
))
&&
q2
===
"
AND
"
&&
q0
!==
"
NOT
"
)
{
let
active
=
true
let
type
=
t3
let
joined
=
[
q1
,
q3
]
i
=
i
+
3
while
(
active
)
{
const
q4
=
query
[
i
];
const
t4
=
types
[
i
];
const
q5
=
query
[
i
+
1
];
const
t5
=
types
[
i
+
1
];
if
(
q4
===
"
AND
"
&&
t5
===
type
)
{
joined
.
push
(
q5
)
i
+=
2
}
else
{
active
=
false
newQuery
.
push
(
joined
.
join
(
"
,
"
))
newTypes
.
push
(
type
)
}
}
}
else
{
...
...
@@ -404,7 +400,7 @@ class SearchBox{
for
(
let
i
=
0
;
i
<
query
.
length
;
++
i
)
{
let
q
=
query
[
i
];
let
t
=
types
[
i
];
if
(
t
===
"
E
"
||
t
===
"
EL
"
)
{
if
(
t
===
"
E
"
)
{
if
(
allowOtherElements
)
{
q
=
"
elements HAS ALL
"
+
q
}
else
{
...
...
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