Skip to content
This repository was archived by the owner on Nov 19, 2021. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
$mSearch = $modx->getService('msearch','mSearch',$modx->getOption('core_path').'components/msearch/model/msearch/',$scriptProperties);
if (!($mSearch instanceof mSearch)) return '';

//reconfigurate mSearch
if($reconfig==1)
$mSearch->reconfigurate($scriptProperties);

// Обрабатываем поисковый запрос
if (isset($_REQUEST[$queryVar])) {
$query = trim(strip_tags($_REQUEST[$queryVar]));
Expand Down Expand Up @@ -100,4 +104,4 @@
return;
}
return implode($outputSeparator, $result);
}
}
10 changes: 8 additions & 2 deletions core/components/msearch/model/msearch/msearch.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function __construct(modX &$modx,array $config = array()) {
$assetsUrl = $this->modx->getOption('msearch.assets_url',$config,$this->modx->getOption('assets_url').'components/msearch/');
$connectorUrl = $assetsUrl.'connector.php';

$this->config = array_merge(array(
$this->config = array(
'assetsUrl' => $assetsUrl
,'cssUrl' => $assetsUrl.'css/'
,'jsUrl' => $assetsUrl.'js/'
Expand All @@ -31,8 +31,14 @@ function __construct(modX &$modx,array $config = array()) {
,'morphy_lang' => $this->modx->getOption('msearch.lang')
,'morphy_storage' => 'mem'
,'disablePhpMorphy' => false
),$config);
);
$this->reconfigurate($config);

}

public function reconfigurate(array $config = array()) {
$this->config = array_merge($this->config,$config);

if (isset($this->config['sortFilters'])) {$this->config['sortFilters'] = explode(',', $this->config['sortFilters']);}

$this->modx->addPackage('msearch',$this->config['modelPath'], $this->modx->config['table_prefix'].'mse_');
Expand Down