mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00:00
Compare commits
2 commits
63f8fbfeee
...
acbaf8f51a
Author | SHA1 | Date | |
---|---|---|---|
|
acbaf8f51a | ||
|
043c8ec386 |
1 changed files with 41 additions and 3 deletions
|
@ -268,9 +268,47 @@ class fulltext_sphinx implements search_backend_interface
|
||||||
$this->sphinx->SetMatchMode(SPH_MATCH_ANY);
|
$this->sphinx->SetMatchMode(SPH_MATCH_ANY);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strlen($keywords) > 0)
|
// Split words
|
||||||
|
$split_keywords = preg_replace('#([^\p{L}\p{N}\'*"()])#u', '$1$1', str_replace('\'\'', '\' \'', trim($keywords)));
|
||||||
|
$matches = array();
|
||||||
|
preg_match_all('#(?:[^\p{L}\p{N}*"()]|^)([+\-|]?(?:[\p{L}\p{N}*"()]+\'?)*[\p{L}\p{N}*"()])(?:[^\p{L}\p{N}*"()]|$)#u', $split_keywords, $matches);
|
||||||
|
$this->split_words = $matches[1];
|
||||||
|
|
||||||
|
if ($terms == 'any')
|
||||||
{
|
{
|
||||||
$this->search_query = str_replace('"', '"', $keywords);
|
$this->search_query = '';
|
||||||
|
foreach ($this->split_words as $word)
|
||||||
|
{
|
||||||
|
if ((strpos($word, '+') === 0) || (strpos($word, '-') === 0) || (strpos($word, '|') === 0))
|
||||||
|
{
|
||||||
|
$word = substr($word, 1);
|
||||||
|
}
|
||||||
|
$this->search_query .= $word . ' ';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->search_query = '';
|
||||||
|
foreach ($this->split_words as $word)
|
||||||
|
{
|
||||||
|
if ((strpos($word, '+') === 0) || (strpos($word, '-') === 0))
|
||||||
|
{
|
||||||
|
$this->search_query .= $word . ' ';
|
||||||
|
}
|
||||||
|
else if (strpos($word, '|') === 0)
|
||||||
|
{
|
||||||
|
$this->search_query .= substr($word, 1) . ' ';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->search_query .= '+' . $word . ' ';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->search_query)
|
||||||
|
{
|
||||||
|
$this->search_query = str_replace('"', '"', $this->search_query);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -952,7 +990,7 @@ class fulltext_sphinx implements search_backend_interface
|
||||||
array('read_timeout', '5'),
|
array('read_timeout', '5'),
|
||||||
array('max_children', '30'),
|
array('max_children', '30'),
|
||||||
array('pid_file', $this->config['fulltext_sphinx_data_path'] . 'searchd.pid'),
|
array('pid_file', $this->config['fulltext_sphinx_data_path'] . 'searchd.pid'),
|
||||||
array('binlog_path', rtrim($this->config['fulltext_sphinx_data_path'], '/\\')), // Trim trailing slash
|
array('binlog_path', $this->config['fulltext_sphinx_data_path']),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue