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
5714d658
Commit
5714d658
authored
Feb 12, 2021
by
Lauri Himanen
Browse files
Getting close to working implementation.
parent
1fa24546
Changes
1
Hide whitespace changes
Inline
Side-by-side
client/src/search-mod/SearchBox.view.js
View file @
5714d658
...
...
@@ -85,7 +85,7 @@ class SearchBox{
let
query
=
[...
this
.
searchQuery
];
let
types
=
[...
this
.
queryTypes
];
// For combining elements connected by AND into a list
// For combining elements
/formules
connected by AND into a
single
list
function
combineANDIn
(
query
,
types
)
{
const
newQuery
=
[]
const
newTypes
=
[]
...
...
@@ -99,22 +99,27 @@ class SearchBox{
const
q3
=
query
[
i
+
2
];
const
t3
=
types
[
i
+
2
];
if
((
t1
===
"
E
"
||
t1
===
"
EL
"
)
&&
(
t3
===
"
E
"
||
t3
===
"
EL
"
)
&&
q2
===
"
AND
"
&&
q0
!==
"
NOT
"
)
{
let
active
=
true
let
elements
=
[
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
"
))
{
elements
.
push
(
q5
)
i
+=
2
}
else
{
active
=
false
newQuery
.
push
(
elements
.
join
(
"
,
"
))
newTypes
.
push
(
"
EL
"
)
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
"
)
}
}
}
}
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