Skip to content

Commit

Permalink
Release 6.6.4 (#190)
Browse files Browse the repository at this point in the history
* reindex reworked, release

* versionnumbers fixed
  • Loading branch information
Norbert Micheel authored Feb 25, 2019
1 parent ead9900 commit 4b6d357
Show file tree
Hide file tree
Showing 10 changed files with 53 additions and 44 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# Änderungen von search_it

## Version 6.6.4 (2019-02-25)
- Reindexierung überarbeitet, zusätzlicher EP "MEDIA_DELETED"
- highlighter fix #186 thx @alexwenz
- rex_escape statt htmlspecialchars
- Versuch fix PHP 7.3 @rolandsee
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
The MIT License (MIT)
MIT License

Copyright (c) 2016 Friends Of REDAXO

Expand Down
1 change: 1 addition & 0 deletions boot.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
'CAT_UPDATED',
'MEDIA_ADDED',
'MEDIA_UPDATED',
'MEDIA_DELETED',
'SLICE_ADDED',
'SLICE_DELETED',
'SLICE_UPDATED',
Expand Down
4 changes: 3 additions & 1 deletion functions/functions_search_it.php
Original file line number Diff line number Diff line change
Expand Up @@ -262,9 +262,11 @@ function search_it_handle_extensionpoint($_ep){
break;

case 'MEDIA_ADDED':
case 'MEDIA_DELETED':
foreach( $includeColumns as $table => $columnArray){
if($table == rex::getTable('media')){
foreach($columnArray as $column) {$tex[] = $table.$column;
foreach($columnArray as $column) {
// extension point liefert nicht die id des neuen/entfernten Mediums
$search_it->indexColumn($table, $column);
}
}
Expand Down
49 changes: 26 additions & 23 deletions lib/search_it.php
Original file line number Diff line number Diff line change
Expand Up @@ -393,35 +393,37 @@ public function unindexArticle($_id, $_clang = false)
*
* @return mixed
*/
public function indexColumn($_table, $_column, $_idcol = false, $_id = false, $_start = false, $_count = false, $_where = false)
public function indexColumn($_table, $_column, $_idcol = false, $_id = false, $_start = false, $_count = false, $_wherecondition = false)
{
$delete = rex_sql::factory();
$delete->setTable($this->tablePrefix . 'search_it_index');

$where = sprintf(" `ftable` = '%s' AND `fcolumn` = '%s' AND `texttype` = 'db_column'", $_table, $_column);
//lus: reaktiviert damit einzeln gelöscht werden kann
if (is_string($_idcol) AND ($_id !== false)) {
$where .= sprintf(' AND fid = %d', $_id);

} elseif (is_numeric($_start) AND is_numeric($_count)) {
$where .= ' LIMIT ' . $_start . ',' . $_count;
}
$delete->setWhere($where);

$cache = clone $delete;

// delete from cache
$select = rex_sql::factory();
$select->setTable($this->tablePrefix . 'search_it_index');
$select->setWhere($where);
$indexIds = array();
if ($select->select('id')) {
foreach ($select->getArray() as $result) {
if ($cache->select('id')) {
foreach ($cache->getArray() as $result) {
$indexIds[] = $result['id'];
}
$this->deleteCache($indexIds);
}

// delete old data + lus: immer alle löschen
if ($_start === 0 || $_start === false || (is_string($_idcol) AND ($_id !== false))) {
$delete->setTable($this->tablePrefix . 'search_it_index');
$delete->setWhere($where);
// delete from index
$delete->delete();
}


// NEW
$sql = rex_sql::factory();

// get primary key column(s)
Expand All @@ -433,20 +435,15 @@ public function indexColumn($_table, $_column, $_idcol = false, $_id = false, $_
// index column
$sql->flushValues();
$sql->setTable($_table);

$where = '1 ';
if (is_string($_idcol) AND $_id) {
$where .= sprintf(' AND (%s = %d)', $_idcol, $_id);
}
if (!empty($_where) AND is_string($_where)) {
// lus: sorry,muss ale neu schreiben, weil ich oben alle lösche
//$where .= ' AND (' . $_where . ')';
}

if (is_numeric($_start) AND is_numeric($_count)) {
} elseif (is_numeric($_start) AND is_numeric($_count)) {
$where .= ' LIMIT ' . $_start . ',' . $_count;
}

$sql->setWhere($where);

$count = false;
if ($sql->select('*')) {

Expand Down Expand Up @@ -485,7 +482,8 @@ public function indexColumn($_table, $_column, $_idcol = false, $_id = false, $_
}

if (is_null($indexData['fid'])) {
$indexData['fid'] = $this->getMinFID();
// keine id Spalte und keine primär schlüssel auch die views landen hier
$indexData['fid'] = $this->getMaxFID($_table);
}
if (array_key_exists('parent_id', $row)) {
$indexData['catid'] = $row['parent_id'];
Expand Down Expand Up @@ -543,9 +541,6 @@ public function indexColumn($_table, $_column, $_idcol = false, $_id = false, $_

$this->storeKeywords($keywords, false);


} else {
return false;
}

return $count;
Expand Down Expand Up @@ -815,6 +810,14 @@ private static function getMinFID()
return ($minfid < 0) ? --$minfid : -1;
}

private static function getMaxFID($_table)
{
$maxfid_sql = rex_sql::factory();
$maxfid_result = $maxfid_sql->getArray('SELECT MAX(CONVERT(fid, SIGNED)) as maxfid FROM `' . rex::getTable('search_it_index') . '` WHERE ftable = "'.$_table.'" ');
$maxfid = intval($maxfid_result[0]['maxfid']);

return ($maxfid > 0) ? ++$maxfid : 1;
}
/**
* Deletes the complete search index.
*
Expand Down
2 changes: 1 addition & 1 deletion package.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package: search_it
version: '6.6.3'
version: '6.6.4'
author: Friends Of REDAXO
supportpage: https://github.com/FriendsOfREDAXO/search_it

Expand Down
30 changes: 15 additions & 15 deletions plugins/autocomplete/package.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package: search_it/autocomplete
version: '6.6.3'
author: Manétage

title: 'translate:search_it_autocomplete_plugin_title'
description: 'translate:search_it_autocomplete_plugin'

page:
perm: search_it[plugin:autocomplete]
title: 'translate:search_it_autocomplete_plugin_title'
icon: rex-icon fa-commenting

requires:
php:
extensions: [gd]
package: search_it/autocomplete
version: '6.6.4'
author: Manétage

title: 'translate:search_it_autocomplete_plugin_title'
description: 'translate:search_it_autocomplete_plugin'

page:
perm: search_it[plugin:autocomplete]
title: 'translate:search_it_autocomplete_plugin_title'
icon: rex-icon fa-commenting

requires:
php:
extensions: [gd]
2 changes: 1 addition & 1 deletion plugins/documentation/package.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package: search_it/documentation
version: '6.6.3'
version: '6.6.4'
author: Friends Of REDAXO

title: 'translate:search_it_documentation_title'
Expand Down
2 changes: 1 addition & 1 deletion plugins/plaintext/package.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package: search_it/plaintext
version: '6.6.3'
version: '6.6.4'
author: Friends Of REDAXO

title: 'translate:search_it_plaintext_title'
Expand Down
2 changes: 1 addition & 1 deletion plugins/stats/package.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package: search_it/stats
version: '6.6.3'
version: '6.6.4'
author: Friends Of REDAXO

title: 'translate:search_it_stats_plugin_title'
Expand Down

0 comments on commit 4b6d357

Please sign in to comment.