implementazione advanced search, alert per stringa vuota in simple query

This commit is contained in:
cesare 2022-12-13 11:15:26 +01:00
parent 0b9ce4073a
commit e1857bb683
2 changed files with 11 additions and 6 deletions

View File

@ -168,7 +168,10 @@ $(document).ready(function() {
esprlogica = [] esprlogica = []
jsonQuery=getJsonQuery() jsonQuery=getJsonQuery()
console.log("got json query") console.log("got json query")
if(jsonQuery['QueryAvanzata']==0 && jsonQuery['Clausola0']['queryText']==''){
alert('Digitare una stringa da cercare')
return
}
jsonQuery = buildSQ(jsonQuery) jsonQuery = buildSQ(jsonQuery)
myquery = new sparqlGenerator().stringify(jsonQuery) myquery = new sparqlGenerator().stringify(jsonQuery)

View File

@ -323,7 +323,7 @@ function buildSQ(stquery) {
if (stquery['EsprLogica'] != null && stquery['EsprLogica'] != '' && stquery['EsprLogica'].length == 1) { if (stquery['EsprLogica'] != null && stquery['EsprLogica'] != '' && stquery['EsprLogica'].length == 1) {
clause = stquery['EsprLogica'] clause = stquery['EsprLogica']
myquery = buildClause(stquery[clause], parsedquery, 0) myquery = buildClause(stquery[clause], parsedquery, 2)
return (myquery) return (myquery)
} }
@ -349,6 +349,7 @@ function buildSQ(stquery) {
parsedquery.where[0].expression.args[0].value = "lm"; parsedquery.where[0].expression.args[0].value = "lm";
} }
else { else {
console.log('Simple query, no param')
parsedquery.where.splice(0, 1) parsedquery.where.splice(0, 1)
} }
@ -423,13 +424,14 @@ function buildClause(clause, parsedquery, whereind) {
else else
strval = clause['queryText'].trim().slice(0, -1) 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') if (clause['lemma_forma'] == 'lemma')
parsedquery.where[1].expression.args[0].value = "lm"; parsedquery.where[0].expression.args[0].value = "lm";
} }
else { else {
if (parsedquery.where[1].type == 'filter' && parsedquery.where[1].expression.args[0].value == 'Rappresentazione') if (parsedquery.where[0].type == 'filter' && parsedquery.where[0].expression.args[0].value == 'Rappresentazione')
parsedquery.where.splice(1, 1) parsedquery.where.splice(0, 1)
whereind=whereind-1
} }
if (clause['typeGramm0'] != null && clause['typeGramm0'] != "all") if (clause['typeGramm0'] != null && clause['typeGramm0'] != "all")
if (whereind > -1) if (whereind > -1)