Changeset View
Changeset View
Standalone View
Standalone View
core/units/categories/categories_event_handler.php
Show First 20 Lines • Show All 2757 Lines • ▼ Show 20 Line(s) | |||||
$relevance_clause = '('.implode(' + ', $revelance_parts).') / '.$weight_sum.' * '.$rel_keywords; | $relevance_clause = '('.implode(' + ', $revelance_parts).') / '.$weight_sum.' * '.$rel_keywords; | ||||
if ($rel_pop && $object->isField('Hits')) { | if ($rel_pop && $object->isField('Hits')) { | ||||
$relevance_clause .= ' + (Hits + 1) / (MAX(Hits) + 1) * '.$rel_pop; | $relevance_clause .= ' + (Hits + 1) / (MAX(Hits) + 1) * '.$rel_pop; | ||||
} | } | ||||
if ($rel_rating && $object->isField('CachedRating')) { | if ($rel_rating && $object->isField('CachedRating')) { | ||||
$relevance_clause .= ' + (CachedRating + 1) / (MAX(CachedRating) + 1) * '.$rel_rating; | $relevance_clause .= ' + (CachedRating + 1) / (MAX(CachedRating) + 1) * '.$rel_rating; | ||||
} | } | ||||
// building final search query | // building final search query | ||||
Lint: CodingStandard.Commenting.InlineComment.InvalidEndChar: Inline comments must end in full-stops, exclamation marks, or question marks | |||||
Inline comments must start with a capital letter Lint: CodingStandard.Commenting.InlineComment.NotCapital: Inline comments must start with a capital letter | |||||
$search_table_exists = $this->Conn->Query('SHOW TABLES LIKE "'.$search_table.'"'); | |||||
Expected 1 space before concat operator; 0 found Lint: CodingStandard.Strings.ConcatenationSpacing.NoSpaceBefore: Expected 1 space before concat operator; 0 found | |||||
Expected 1 space after concat operator; 0 found Lint: CodingStandard.Strings.ConcatenationSpacing.NoSpaceAfter: Expected 1 space after concat operator; 0 found | |||||
Expected 1 space before concat operator; 0 found Lint: CodingStandard.Strings.ConcatenationSpacing.NoSpaceBefore: Expected 1 space before concat operator; 0 found | |||||
Expected 1 space after concat operator; 0 found Lint: CodingStandard.Strings.ConcatenationSpacing.NoSpaceAfter: Expected 1 space after concat operator; 0 found | |||||
if (!$this->Application->GetVar('do_not_drop_search_table')) { | if (!$this->Application->GetVar('do_not_drop_search_table')) { | ||||
Expected 1 spaces before "if" closing bracket; 0 found Lint: CodingStandard.WhiteSpace.ControlStructureSpacing.SpaceBeforeCloseBrace: Expected 1 spaces before "if" closing bracket; 0 found | |||||
Expected 1 spaces after "if" opening bracket; 0 found Lint: CodingStandard.WhiteSpace.ControlStructureSpacing.SpacingAfterOpenBrace: Expected 1 spaces after "if" opening bracket; 0 found | |||||
$this->Conn->Query('DROP TABLE IF EXISTS '.$search_table); // erase old search table if clean k4 event | if ( $search_table_exists ) { | ||||
$this->Conn->Query('TRUNCATE TABLE '.$search_table); | |||||
Expected 1 space after concat operator; 0 found Lint: CodingStandard.Strings.ConcatenationSpacing.NoSpaceAfter: Expected 1 space after concat operator; 0 found | |||||
Expected 1 space before concat operator; 0 found Lint: CodingStandard.Strings.ConcatenationSpacing.NoSpaceBefore: Expected 1 space before concat operator; 0 found | |||||
} | |||||
$this->Application->SetVar('do_not_drop_search_table', true); | $this->Application->SetVar('do_not_drop_search_table', true); | ||||
} | } | ||||
$search_table_exists = $this->Conn->Query('SHOW TABLES LIKE "'.$search_table.'"'); | |||||
if ($search_table_exists) { | if ($search_table_exists) { | ||||
$select_intro = 'INSERT INTO '.$search_table.' (Relevance, ItemId, ResourceId, ItemType, EdPick) '; | $select_intro = 'INSERT INTO '.$search_table.' (Relevance, ItemId, ResourceId, ItemType, EdPick) '; | ||||
} | } | ||||
else { | else { | ||||
$select_intro = 'CREATE TABLE '.$search_table.' AS '; | $select_intro = 'CREATE TABLE '.$search_table.' ENGINE = MEMORY AS '; | ||||
Expected 1 space before concat operator; 0 found Lint: CodingStandard.Strings.ConcatenationSpacing.NoSpaceBefore: Expected 1 space before concat operator; 0 found | |||||
Expected 1 space after concat operator; 0 found Lint: CodingStandard.Strings.ConcatenationSpacing.NoSpaceAfter: Expected 1 space after concat operator; 0 found | |||||
Expected 1 space after concat operator; 0 found Lint: CodingStandard.Strings.ConcatenationSpacing.NoSpaceAfter: Expected 1 space after concat operator; 0 found | |||||
Expected 1 space before concat operator; 0 found Lint: CodingStandard.Strings.ConcatenationSpacing.NoSpaceBefore: Expected 1 space before concat operator; 0 found | |||||
} | } | ||||
$edpick_clause = $this->Application->getUnitOption($event->Prefix.'.EditorsPick', 'Fields') ? $items_table.'.EditorsPick' : '0'; | $edpick_clause = $this->Application->getUnitOption($event->Prefix.'.EditorsPick', 'Fields') ? $items_table.'.EditorsPick' : '0'; | ||||
$sql = $select_intro.' SELECT '.$relevance_clause.' AS Relevance, | $sql = $select_intro.' SELECT '.$relevance_clause.' AS Relevance, | ||||
'.$items_table.'.'.$this->Application->getUnitOption($event->Prefix, 'IDField').' AS ItemId, | '.$items_table.'.'.$this->Application->getUnitOption($event->Prefix, 'IDField').' AS ItemId, | ||||
'.$items_table.'.ResourceId, | '.$items_table.'.ResourceId, | ||||
'.$this->Application->getUnitOption($event->Prefix, 'ItemType').' AS ItemType, | '.$this->Application->getUnitOption($event->Prefix, 'ItemType').' AS ItemType, | ||||
▲ Show 20 Lines • Show All 442 Lines • Show Last 20 Lines |
Inline comments must end in full-stops, exclamation marks, or question marks