Commit 9bc12cad authored by Iker Hurtado's avatar Iker Hurtado
Browse files

Complex search logic implementation (12)

parent df619e2f
......@@ -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').checked ){ // reduced search
if ( reduced ){ // reduced search
pFormula = this._reduceFormula(formula, false);
queryObj.push(this._getESSimpleMatch('formula_reduced_keyword', pFormula));
}else{
......
......@@ -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').checked ){ // reduced search
if ( reduced ){ // reduced search
pFormula = this._reduceFormula(formula, false);
queryObj.push(this._getESSimpleMatch('formula_reduced_keyword', pFormula));
}else{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment