diff --git a/js/cesareBrowse.js b/js/cesareBrowse.js index c1c5a68..cbf0345 100644 --- a/js/cesareBrowse.js +++ b/js/cesareBrowse.js @@ -168,7 +168,10 @@ $(document).ready(function() { esprlogica = [] jsonQuery=getJsonQuery() console.log("got json query") - + if(jsonQuery['QueryAvanzata']==0 && jsonQuery['Clausola0']['queryText']==''){ + alert('Digitare una stringa da cercare') + return + } jsonQuery = buildSQ(jsonQuery) myquery = new sparqlGenerator().stringify(jsonQuery) diff --git a/js/utils.js b/js/utils.js index b50742c..085e8ef 100644 --- a/js/utils.js +++ b/js/utils.js @@ -323,7 +323,7 @@ function buildSQ(stquery) { if (stquery['EsprLogica'] != null && stquery['EsprLogica'] != '' && stquery['EsprLogica'].length == 1) { clause = stquery['EsprLogica'] - myquery = buildClause(stquery[clause], parsedquery, 0) + myquery = buildClause(stquery[clause], parsedquery, 2) return (myquery) } @@ -349,6 +349,7 @@ function buildSQ(stquery) { parsedquery.where[0].expression.args[0].value = "lm"; } else { + console.log('Simple query, no param') parsedquery.where.splice(0, 1) } @@ -423,13 +424,14 @@ function buildClause(clause, parsedquery, whereind) { else strval = clause['queryText'].trim().slice(0, -1) - parsedquery.where[1].expression.args[1].value = strval; + parsedquery.where[0].expression.args[1].value = strval; if (clause['lemma_forma'] == 'lemma') - parsedquery.where[1].expression.args[0].value = "lm"; + parsedquery.where[0].expression.args[0].value = "lm"; } else { - if (parsedquery.where[1].type == 'filter' && parsedquery.where[1].expression.args[0].value == 'Rappresentazione') - parsedquery.where.splice(1, 1) + if (parsedquery.where[0].type == 'filter' && parsedquery.where[0].expression.args[0].value == 'Rappresentazione') + parsedquery.where.splice(0, 1) + whereind=whereind-1 } if (clause['typeGramm0'] != null && clause['typeGramm0'] != "all") if (whereind > -1)