bug fixing query

This commit is contained in:
cesare 2024-12-09 12:46:22 +01:00
parent c5fa391591
commit 8cee5a8c39
2 changed files with 15 additions and 13 deletions

View File

@ -355,7 +355,7 @@ $(document).ready(function() {
res.sort(function(a, b) { return a - b }); res.sort(function(a, b) { return a - b });
return (res) return (res)
} }
if (listaClausoleRisultatoContesti.length) { if (listaClausoleRisultatoContesti.length && !listarisultati.length ) {
/*for (risultato of listaClausoleRisultatoContesti) { /*for (risultato of listaClausoleRisultatoContesti) {
contaContesti = contaContesti + 1; contaContesti = contaContesti + 1;
@ -368,7 +368,7 @@ $(document).ready(function() {
for (i=startcont; i<=endcont; i++){ for (i=startcont; i<=endcont; i++){
res.push(listaClausoleRisultatoContesti[i]) res.push(listaClausoleRisultatoContesti[i])
} }
res.sort(function(a, b) { puno = a[0].split('-')[3]; pdue = b[0].split('-')[3]; return parseInt(puno) - parseInt(pdue) }); //res.sort(function(a, b) { puno = a[0].split('-')[3]; pdue = b[0].split('-')[3]; return parseInt(puno) - parseInt(pdue) });
return (res) return (res)
} }
return (res) return (res)
@ -452,13 +452,13 @@ $(document).ready(function() {
comandiGrp.attr('class', 'btn-group flex-nowrap d-inline pr-3 mt-1 mr-3 align-text-bottom'); comandiGrp.attr('class', 'btn-group flex-nowrap d-inline pr-3 mt-1 mr-3 align-text-bottom');
comandiGrp.attr('role', "group") comandiGrp.attr('role', "group")
var spanBadgeExpand = $('<button />'); var spanBadgeExpand = $('<button class="btn btn-sm btn-outline-primary espandiFrase px-1 pt-1 pb-0"/>');
var expandIcon = '<ion-icon name="expand-outline"></ion-icon>'; var expandIcon = '<ion-icon name="expand-outline"></ion-icon>';
spanBadgeExpand.attr('class', 'btn btn-sm btn-outline-primary espandiFrase px-1 pt-1 pb-0'); //spanBadgeExpand.attr('class', 'btn btn-sm btn-outline-primary espandiFrase px-1 pt-1 pb-0');
var spanBadgeReduce = $('<button />'); var spanBadgeReduce = $('<button class="btn btn-sm btn-outline-secondary riduciFrase px-1 pt-1 pb-0 ml-1 disabled"/>');
var reduceIcon = '<ion-icon name="contract-outline"></ion-icon>'; var reduceIcon = '<ion-icon name="contract-outline"></ion-icon>';
spanBadgeReduce.attr('class', 'btn btn-sm btn-outline-secondary riduciFrase px-1 pt-1 pb-0 ml-1 disabled'); //spanBadgeReduce.attr('class', 'btn btn-sm btn-outline-secondary riduciFrase px-1 pt-1 pb-0 ml-1 disabled');
//spanBadgeExpand.attr('id', getCantica(numeroCantica) + "Canto_ex_" + canto + "_" + risultato + "_" + numeroRisultato); //spanBadgeExpand.attr('id', getCantica(numeroCantica) + "Canto_ex_" + canto + "_" + risultato + "_" + numeroRisultato);
spanBadgeExpand.attr('id', getCantica(numeroCantica) + "Canto_ex_" + canto + "_" + ctxpivot + "_" + numeroRisultato); spanBadgeExpand.attr('id', getCantica(numeroCantica) + "Canto_ex_" + canto + "_" + ctxpivot + "_" + numeroRisultato);
@ -1433,6 +1433,7 @@ $(document).ready(function() {
listarisultati = [] listarisultati = []
listaPeriodiRisultato = [] listaPeriodiRisultato = []
listaClausoleRisultato = [] listaClausoleRisultato = []
listaClausoleRisultatoContesti = []
resultSentences = new Set() resultSentences = new Set()
if (cantoDisplayed == '#vistaFrasi') if (cantoDisplayed == '#vistaFrasi')
cantoDisplayed = prevCantoDisplayed cantoDisplayed = prevCantoDisplayed
@ -1962,6 +1963,7 @@ $(document).ready(function() {
listaPeriodiRisultato = [] listaPeriodiRisultato = []
listaClausoleRisultato = [] listaClausoleRisultato = []
listaClausoleRisultatoContesti = []
//Unità di ricerca è 'frase' //Unità di ricerca è 'frase'
if ((!listarisultati.length && unitaRicerca == 'forme') || unitaRicerca == 'frase') { if ((!listarisultati.length && unitaRicerca == 'forme') || unitaRicerca == 'frase') {
@ -1980,7 +1982,7 @@ $(document).ready(function() {
//if (!resSent.has(fraseItems[0] + '-' + fraseItems[3])) { //if (!resSent.has(fraseItems[0] + '-' + fraseItems[3])) {
let tmpocc = fraseItems.slice(-1) let tmpocc = fraseItems.slice(-1)
if (resClauses.filter(clocc => clocc == tmpocc[0]).length == 0) { if (resClauses.filter(clocc => clocc == tmpocc[0]).length == 0 || tmpocc[0]=='') {
resClauses.push(tmpocc[0]); resClauses.push(tmpocc[0]);
//resSent.add(fraseItems[0] + '-' + fraseItems[3]+'-'+fraseItems[1] + '-' + fraseItems[2]); //resSent.add(fraseItems[0] + '-' + fraseItems[3]+'-'+fraseItems[1] + '-' + fraseItems[2]);
resSentence.add(fraseItems[1] + '-' + fraseItems[2]); resSentence.add(fraseItems[1] + '-' + fraseItems[2]);

View File

@ -393,7 +393,7 @@ function buildSPQuery(guiquery) {
theguiQ = guiquery; theguiQ = guiquery;
var SparqlParser = sparqljs.Parser; var SparqlParser = sparqljs.Parser;
var spqparser = new SparqlParser(); var spqparser = new SparqlParser();
if (theguiQ['unitaRicerca'] == 'periodo') {//Multiple Conditions UR=Periodo if (theguiQ['unitaRicerca'] == 'periodo' || theguiQ['unitaRicerca'] == 'frase') {//Multiple Conditions UR=Periodo
multipleCondSpQuery = spqparser.parse(sentencetargetquery); multipleCondSpQuery = spqparser.parse(sentencetargetquery);
bindConcatStatement = JSON.parse(sentencetarget_functionbind); bindConcatStatement = JSON.parse(sentencetarget_functionbind);
occBindConcatStatement = JSON.parse(sentencetarget_occbind); occBindConcatStatement = JSON.parse(sentencetarget_occbind);
@ -413,7 +413,7 @@ function buildSPQuery(guiquery) {
parseJsonClause(ck, jsonclauses[ck], multipleCondSpQuery.where) parseJsonClause(ck, jsonclauses[ck], multipleCondSpQuery.where)
} }
if (theguiQ['unitaRicerca'] == 'periodo') { if (theguiQ['unitaRicerca'] == 'periodo' || theguiQ['unitaRicerca'] == 'frase') {
multipleCondSpQuery.where.push(bindConcatStatement) multipleCondSpQuery.where.push(bindConcatStatement)
multipleCondSpQuery.where.push(occBindConcatStatement) multipleCondSpQuery.where.push(occBindConcatStatement)
@ -565,13 +565,13 @@ function buildStatementClause(clause, parsedquery, whereind, theplace, token) {
// //
var tmpgroup = '' var tmpgroup = ''
if (clause['TipoClausola'] == "Sintattico") { if (clause['TipoClausola'] == "Sintattico") {
if (theguiQ['unitaRicerca'] == 'periodo') if (theguiQ['unitaRicerca'] == 'periodo' || theguiQ['unitaRicerca'] == 'frase')
tmpgroup = JSON.parse(sentencetarget_syntgroup) tmpgroup = JSON.parse(sentencetarget_syntgroup)
else else
tmpgroup = JSON.parse(syntgroup) tmpgroup = JSON.parse(syntgroup)
} }
if (clause['TipoClausola'] == "Grammaticale") { if (clause['TipoClausola'] == "Grammaticale") {
if (theguiQ['unitaRicerca'] == 'periodo') { if (theguiQ['unitaRicerca'] == 'periodo' || theguiQ['unitaRicerca'] == 'frase') {
tmpgroup = JSON.parse(sentencetarget_morphgroup_short) tmpgroup = JSON.parse(sentencetarget_morphgroup_short)
} }
@ -630,7 +630,7 @@ function buildStatementClause(clause, parsedquery, whereind, theplace, token) {
} }
if (clause['TipoClausola'] == 'Grammaticale') { if (clause['TipoClausola'] == 'Grammaticale') {
if (theguiQ['unitaRicerca'] == 'periodo') { if (theguiQ['unitaRicerca'] == 'periodo' || theguiQ['unitaRicerca'] == 'frase') {
var tmpg = JSON.stringify(tmpgroup) var tmpg = JSON.stringify(tmpgroup)
tmpg = tmpg.replaceAll('"Rappresentazione"', '"Rappresentazione' + token + '"') tmpg = tmpg.replaceAll('"Rappresentazione"', '"Rappresentazione' + token + '"')
tmpg = tmpg.replaceAll('"form"', '"form' + token + '"') tmpg = tmpg.replaceAll('"form"', '"form' + token + '"')
@ -712,7 +712,7 @@ function buildStatementClause(clause, parsedquery, whereind, theplace, token) {
} }
} }
if (theguiQ['unitaRicerca'] == 'periodo') { if (theguiQ['unitaRicerca'] == 'periodo' || theguiQ['unitaRicerca'] == 'frase') {
mytest = JSON.stringify(tmpgroup) mytest = JSON.stringify(tmpgroup)
mytest = mytest.replaceAll(':"cl"', ':"cl' + token + '"') mytest = mytest.replaceAll(':"cl"', ':"cl' + token + '"')
mytest = mytest.replaceAll(':"clatype"', ':"clatype' + token + '"') mytest = mytest.replaceAll(':"clatype"', ':"clatype' + token + '"')