Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
nomad-lab
encyclopedia-gui
Commits
9bc12cad
Commit
9bc12cad
authored
Oct 23, 2018
by
Iker Hurtado
Browse files
Complex search logic implementation (12)
parent
df619e2f
Changes
2
Hide whitespace changes
Inline
Side-by-side
client/bundle.js
View file @
9bc12cad
...
...
@@ -7969,28 +7969,28 @@
let
rootQueryObj
=
{
'
bool
'
:
{}
};
rootQueryObj
.
bool
.
should
=
[];
let
queryObj
=
rootQueryObj
.
bool
.
should
;
let
reduced
=
this
.
element
.
querySelector
(
'
#multiples-of-formula
'
).
checked
;
formulas
.
forEach
(
formula
=>
{
let
pFormula
;
let
searchByElement
=
(
formula
.
indexOf
(
'
0
'
)
>=
0
);
if
(
searchByElement
){
// There are some element in the search expression
/** TDO**/
pFormula
=
this
.
_processFormula
(
formula
,
'
element-string
'
);
let
f
=
formula
;
if
(
reduced
)
f
=
this
.
_reduceFormula
(
formula
,
false
);
pFormula
=
this
.
_processFormula
(
f
,
'
element-string
'
);
let
tempQueryObj
=
{
'
bool
'
:
{
'
must
'
:
[]
}
};
tempQueryObj
.
bool
.
must
.
push
(
this
.
_getESOperatorMatch
(
'
formula_cell_terms
'
,
pFormula
[
0
]));
this
.
_getESOperatorMatch
(
(
reduced
?
'
formula_reduced_terms
'
:
'
formula_cell_terms
'
),
pFormula
[
0
]));
tempQueryObj
.
bool
.
must
.
push
(
this
.
_getESSimpleMatch
(
'
atom_labels_keyword
'
,
pFormula
[
1
]));
queryObj
.
push
(
tempQueryObj
);
//queryObj.push(this._getESSimpleMatch('atom_labels_keyword', pFormula));
}
else
{
// Only formulas
if
(
this
.
element
.
querySelector
(
'
#multiples-of-formula
'
).
check
ed
){
// reduced search
if
(
reduc
ed
){
// reduced search
pFormula
=
this
.
_reduceFormula
(
formula
,
false
);
queryObj
.
push
(
this
.
_getESSimpleMatch
(
'
formula_reduced_keyword
'
,
pFormula
));
}
else
{
...
...
client/src/search-mod/NewSearchMod.js
View file @
9bc12cad
...
...
@@ -362,28 +362,28 @@ class NewSearchMod {
let
rootQueryObj
=
{
'
bool
'
:
{}
};
rootQueryObj
.
bool
.
should
=
[];
let
queryObj
=
rootQueryObj
.
bool
.
should
;
let
reduced
=
this
.
element
.
querySelector
(
'
#multiples-of-formula
'
).
checked
;
formulas
.
forEach
(
formula
=>
{
let
pFormula
;
let
searchByElement
=
(
formula
.
indexOf
(
'
0
'
)
>=
0
);
if
(
searchByElement
){
// There are some element in the search expression
/** TDO**/
pFormula
=
this
.
_processFormula
(
formula
,
'
element-string
'
);
let
f
=
formula
;
if
(
reduced
)
f
=
this
.
_reduceFormula
(
formula
,
false
);
pFormula
=
this
.
_processFormula
(
f
,
'
element-string
'
);
let
tempQueryObj
=
{
'
bool
'
:
{
'
must
'
:
[]
}
};
tempQueryObj
.
bool
.
must
.
push
(
this
.
_getESOperatorMatch
(
'
formula_cell_terms
'
,
pFormula
[
0
]));
this
.
_getESOperatorMatch
(
(
reduced
?
'
formula_reduced_terms
'
:
'
formula_cell_terms
'
),
pFormula
[
0
]));
tempQueryObj
.
bool
.
must
.
push
(
this
.
_getESSimpleMatch
(
'
atom_labels_keyword
'
,
pFormula
[
1
]));
queryObj
.
push
(
tempQueryObj
);
//queryObj.push(this._getESSimpleMatch('atom_labels_keyword', pFormula));
}
else
{
// Only formulas
if
(
this
.
element
.
querySelector
(
'
#multiples-of-formula
'
).
check
ed
){
// reduced search
if
(
reduc
ed
){
// reduced search
pFormula
=
this
.
_reduceFormula
(
formula
,
false
);
queryObj
.
push
(
this
.
_getESSimpleMatch
(
'
formula_reduced_keyword
'
,
pFormula
));
}
else
{
...
...
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