|
|
@ -24,8 +24,8 @@ class Search |
|
|
|
var $_stem_words = array(); |
|
|
|
var $_stem_words = array(); |
|
|
|
var $_like_t = "(doc.document_title LIKE '%%%s%%')"; |
|
|
|
var $_like_t = "(doc.document_title LIKE '%%%s%%')"; |
|
|
|
var $_not_like_t = "(doc.document_title LIKE '%%%s%%')"; |
|
|
|
var $_not_like_t = "(doc.document_title LIKE '%%%s%%')"; |
|
|
|
var $_like = "(field_value LIKE '%%%s%%')"; |
|
|
|
var $_like = "(CONCAT_WS('', f1.field_value, NULLIF(f2.field_value, '')) LIKE '%%%s%%')"; |
|
|
|
var $_not_like = "(field_value NOT LIKE '%%%s%%')"; |
|
|
|
var $_not_like = "(CONCAT_WS('', f1.field_value, NULLIF(f2.field_value, '')) NOT LIKE '%%%s%%')"; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* ВНУТРЕННИЕ МЕТОДЫ |
|
|
|
* ВНУТРЕННИЕ МЕТОДЫ |
|
|
@ -138,30 +138,39 @@ class Search |
|
|
|
$num = 0; |
|
|
|
$num = 0; |
|
|
|
if ($where != '') |
|
|
|
if ($where != '') |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
$limit = $this->_limit; |
|
|
|
$limit = $this->_limit; |
|
|
|
$start = get_current_page() * $limit - $limit; |
|
|
|
$start = get_current_page() * $limit - $limit; |
|
|
|
|
|
|
|
|
|
|
|
$query_feld = $AVE_DB->Query(" |
|
|
|
$sql = " |
|
|
|
SELECT SQL_CALC_FOUND_ROWS |
|
|
|
SELECT SQL_CALC_FOUND_ROWS |
|
|
|
document_id, |
|
|
|
f1.document_id, |
|
|
|
field_value, |
|
|
|
(SELECT CONCAT_WS('', f1.field_value, NULLIF(f2.field_value, ''))) AS field_value, |
|
|
|
doc.document_title, |
|
|
|
doc.document_title, |
|
|
|
doc.document_published, |
|
|
|
doc.document_published, |
|
|
|
doc.document_in_search |
|
|
|
doc.document_in_search |
|
|
|
FROM " . PREFIX . "_document_fields |
|
|
|
FROM |
|
|
|
LEFT JOIN " . PREFIX . "_documents AS doc |
|
|
|
" . PREFIX . "_document_fields AS f1 |
|
|
|
ON document_id = doc.Id |
|
|
|
LEFT JOIN |
|
|
|
LEFT JOIN " . PREFIX . "_rubric_fields AS rub |
|
|
|
" . PREFIX . "_document_fields_text AS f2 |
|
|
|
ON rubric_field_id = rub.Id |
|
|
|
ON f1.document_id = f2.document_id |
|
|
|
|
|
|
|
LEFT JOIN |
|
|
|
|
|
|
|
" . PREFIX . "_documents AS doc |
|
|
|
|
|
|
|
ON f1.document_id = doc.Id |
|
|
|
|
|
|
|
LEFT JOIN |
|
|
|
|
|
|
|
" . PREFIX . "_rubric_fields AS rub |
|
|
|
|
|
|
|
ON f1.rubric_field_id = rub.Id |
|
|
|
" . $where . " |
|
|
|
" . $where . " |
|
|
|
AND doc.document_in_search = '1' |
|
|
|
AND doc.document_in_search = '1' |
|
|
|
AND doc.document_status = '1' |
|
|
|
AND doc.document_status = '1' |
|
|
|
AND rub.rubric_field_search = '1' |
|
|
|
AND rub.rubric_field_search = '1' |
|
|
|
GROUP BY doc.Id |
|
|
|
GROUP BY doc.Id |
|
|
|
ORDER BY doc.document_published DESC |
|
|
|
ORDER BY doc.rubric_id ASC |
|
|
|
LIMIT " . $start . "," . $limit |
|
|
|
LIMIT " . $start . "," . $limit |
|
|
|
); |
|
|
|
; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$query_feld = $AVE_DB->Query($sql); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Debug::_echo($sql); |
|
|
|
|
|
|
|
|
|
|
|
$num = $AVE_DB->NumAllRows(); |
|
|
|
$num = $AVE_DB->NumAllRows(); |
|
|
|
$pages = @ceil($num / $limit); |
|
|
|
$pages = @ceil($num / $limit); |
|
|
|