From a8efd5ecf098bdc05fbc37a6db7f187445420909 Mon Sep 17 00:00:00 2001 From: Jean-Yves Gaulier Date: Thu, 3 Sep 2015 15:23:48 +0200 Subject: [PATCH] 1.22.2.1 fix : searching "all" with a sort returned records that user should not see bug found by "grand lyon" --- changelog.txt | 39 +++++++++++++++++++++++++++++++++++++++ php_phrasea2/_VERSION.h | 2 +- phrasea_engine/qtree.cpp | 39 ++++++++++++++++++++++++++++++--------- 3 files changed, 70 insertions(+), 10 deletions(-) diff --git a/changelog.txt b/changelog.txt index 7ba86d2..94f135a 100755 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,42 @@ +1.22.2.1 +fix : searching "all" with a sort returned records that user should not see +bug found by "grand lyon" + + +1.22.2.0 +searching with stem (lng) searches also non-stem index +ex. : caption contains "Echappées", searching... + +now + +..."echappees" (whith stemming='fr') --> 0 +..."echappées" (whith stemming='fr') --> found + +..."echappees" (whith stemming='en') --> found +..."echappées" (whith stemming='en') --> found + +..."echappees" (whithout stemming) --> found +..."echappées" (whithout stemming) --> found + +previous version + +..."echappees" (whith stemming='fr') --> +..."échappees" (whith stemming='fr') --> +..."echappées" (whith stemming='fr') --> ok +..."échappées" (whith stemming='fr') --> ok + +..."echappees" (whith stemming='en') --> ok +..."échappees" (whith stemming='en') --> ok +..."echappées" (whith stemming='en') --> ok +..."échappées" (whith stemming='en') --> ok + +..."echappees" (whithout stemming) --> ok +..."échappees" (whithout stemming) --> ok +..."echappées" (whithout stemming) --> ok +..."échappées" (whithout stemming) --> ok + + + 1.22.1.1 fix: search on business sometimes did not work (reopen PHRAS-203) diff --git a/php_phrasea2/_VERSION.h b/php_phrasea2/_VERSION.h index ce0e62f..ddbc5d2 100755 --- a/php_phrasea2/_VERSION.h +++ b/php_phrasea2/_VERSION.h @@ -19,7 +19,7 @@ // #ifndef PHDOTVERSION -#define PHDOTVERSION 1.22.1.1 +#define PHDOTVERSION 1.22.2.1 #endif // //======================================================================= diff --git a/phrasea_engine/qtree.cpp b/phrasea_engine/qtree.cpp index 08f0c90..3fc4f9d 100755 --- a/phrasea_engine/qtree.cpp +++ b/phrasea_engine/qtree.cpp @@ -36,9 +36,18 @@ char *kwclause(Cquerytree2Parm *qp, KEYWORD *k) int llng = 0; if(qp->lng) { - // add lng to the query - // (QQQQ) AND lnq='LNG' - ltot += 1 + (llng = strlen(qp->lng)) + 11 + 1; + if(qp->lng[0] == '\0') + { + // add lng to the query + // "(" + QQQQ + ") AND lnq=''" + ltot += 1 + 12; + } + else + { + // add lng to the query + // "(" + QQQQ + ") AND (lng='' OR lnq='" + LLL + "')" + ltot += 1 + 22 + (llng = strlen(qp->lng)) + 2; + } } KEYWORD *k0 = k; @@ -114,13 +123,25 @@ char *kwclause(Cquerytree2Parm *qp, KEYWORD *k) } } } + // add lng to the query if(qp->lng) { - memcpy(p, ") AND lng='", 11); - p += 11; - memcpy(p, qp->lng, llng); - p += llng; - *p++ = '\''; + if(qp->lng[0] == '\0') + { + memcpy(p, ") AND lng=''", 12); + p += 12; + } + else + { + // memcpy(p, ") AND (lng='' OR lng='", 22); + // p += 22; + memcpy(p, ") AND (lng='", 12); + p += 12; + memcpy(p, qp->lng, llng); + p += llng; + *p++ = '\''; + *p++ = ')'; + } } *p = '\0'; @@ -612,7 +633,7 @@ THREAD_ENTRYPOINT querytree2(void *_qp) "%s%s" // " AND record.recordid=ZZZ" , *(qp->psortField) , qp->multidoc_mode==PHRASEA_MULTIDOC_ALL ? "":(qp->multidoc_mode==PHRASEA_MULTIDOC_DOCONLY ? " AND parent_record_id=0" : " AND parent_record_id=1") - , qp->use_mask ? "" : " AND ((status ^ mask_xor) & mask_and)=0" + , qp->use_mask ? " AND ((status ^ mask_xor) & mask_and)=0" : "" , qp->srid ? " AND record.record_id=" : "" , qp->srid ? qp->srid : "" );