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