mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
commit
a75990ef8c
@ -33,6 +33,7 @@ before_script:
|
|||||||
- composer self-update || true
|
- composer self-update || true
|
||||||
- phpenv rehash
|
- phpenv rehash
|
||||||
- phpenv config-rm xdebug.ini
|
- phpenv config-rm xdebug.ini
|
||||||
|
- echo 'memory_limit = 2048M' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
|
||||||
- git clone git://github.com/silverstripe-labs/silverstripe-travis-support.git ~/travis-support
|
- git clone git://github.com/silverstripe-labs/silverstripe-travis-support.git ~/travis-support
|
||||||
- "if [ \"$BEHAT_TEST\" = \"\" ]; then php ~/travis-support/travis_setup.php --source `pwd` --target ~/builds/ss; fi"
|
- "if [ \"$BEHAT_TEST\" = \"\" ]; then php ~/travis-support/travis_setup.php --source `pwd` --target ~/builds/ss; fi"
|
||||||
- "if [ \"$BEHAT_TEST\" = \"1\" ]; then php ~/travis-support/travis_setup.php --source `pwd` --target ~/builds/ss --require silverstripe/behat-extension; fi"
|
- "if [ \"$BEHAT_TEST\" = \"1\" ]; then php ~/travis-support/travis_setup.php --source `pwd` --target ~/builds/ss --require silverstripe/behat-extension; fi"
|
||||||
|
@ -131,12 +131,12 @@ class SearchForm extends Form {
|
|||||||
|
|
||||||
$keywords = $data['Search'];
|
$keywords = $data['Search'];
|
||||||
|
|
||||||
$andProcessor = create_function('$matches','
|
$andProcessor = function ($matches) {
|
||||||
return " +" . $matches[2] . " +" . $matches[4] . " ";
|
return ' +' . $matches[2] . ' +' . $matches[4] . ' ';
|
||||||
');
|
};
|
||||||
$notProcessor = create_function('$matches', '
|
$notProcessor = function ($matches) {
|
||||||
return " -" . $matches[3];
|
return ' -' . $matches[3];
|
||||||
');
|
};
|
||||||
|
|
||||||
$keywords = preg_replace_callback('/()("[^()"]+")( and )("[^"()]+")()/i', $andProcessor, $keywords);
|
$keywords = preg_replace_callback('/()("[^()"]+")( and )("[^"()]+")()/i', $andProcessor, $keywords);
|
||||||
$keywords = preg_replace_callback('/(^| )([^() ]+)( and )([^ ()]+)( |$)/i', $andProcessor, $keywords);
|
$keywords = preg_replace_callback('/(^| )([^() ]+)( and )([^ ()]+)( |$)/i', $andProcessor, $keywords);
|
||||||
@ -173,15 +173,23 @@ class SearchForm extends Form {
|
|||||||
return $results;
|
return $results;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function addStarsToKeywords($keywords) {
|
protected function addStarsToKeywords($keywords)
|
||||||
if(!trim($keywords)) return "";
|
{
|
||||||
|
if (!trim($keywords)) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
// Add * to each keyword
|
// Add * to each keyword
|
||||||
$splitWords = preg_split("/ +/", trim($keywords));
|
$splitWords = preg_split("/ +/", trim($keywords));
|
||||||
while(list($i,$word) = each($splitWords)) {
|
$newWords = array();
|
||||||
if($word[0] == '"') {
|
for ($i = 0; $i < count($splitWords); $i++) {
|
||||||
while(list($i,$subword) = each($splitWords)) {
|
$word = $splitWords[$i];
|
||||||
|
if ($word[0] === '"') {
|
||||||
|
while (++$i < count($splitWords)) {
|
||||||
|
$subword = $splitWords[$i];
|
||||||
$word .= ' ' . $subword;
|
$word .= ' ' . $subword;
|
||||||
if(substr($subword,-1) == '"') break;
|
if (substr($subword, -1) === '"') {
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$word .= '*';
|
$word .= '*';
|
||||||
|
Loading…
Reference in New Issue
Block a user