implementazione advanced search, alert per stringa vuota in simple query
This commit is contained in:
parent
0b9ce4073a
commit
e1857bb683
|
@ -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)
|
||||||
|
|
12
js/utils.js
12
js/utils.js
|
@ -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)
|
||||||
|
|
Loading…
Reference in New Issue