2 namespace TYPO3\CMS\IndexedSearch\Utility;
33 $tableList =
$GLOBALS[
'TYPO3_CONF_VARS'][
'EXTCONF'][
'indexed_search'][
'use_tables'];
34 return \TYPO3\CMS\Core\Utility\GeneralUtility::inList($tableList, $tableName);
46 return hexdec(substr(md5($stringToHash), 0, 7));
61 $swordArray = array();
62 $sword = trim($sword);
64 $components = self::split($sword);
65 if (is_array($components)) {
68 foreach ($components as $key => $val) {
69 $operator = self::getOperator($val, $operatorTranslateTable);
71 $lastoper = $operator;
72 }
elseif (strlen($val) > 1) {
74 $swordArray[$i][
'sword'] = $val;
75 $swordArray[$i][
'oper'] = $lastoper ?: $defaultOperator;
94 protected static function split($origSword, $specchars =
'+-', $delchars =
'+.,-')
98 $specs =
'[' . preg_quote($specchars,
'/') .
']';
102 if (preg_match(
'/^"/', $sword)) {
104 $sword = preg_replace(
'/^"/',
'', $sword);
106 preg_match(
'/^[^"]*/', $sword, $reg);
109 $sword = preg_replace(
'/^' . preg_quote($reg[0],
'/') .
'/',
'', $sword);
111 $sword = trim(preg_replace(
'/^"/',
'', $sword));
112 }
elseif (preg_match(
'/^' . $specs .
'/', $sword, $reg)) {
115 $sword = trim(preg_replace(
'/^' . $specs .
'/',
'', $sword));
116 }
elseif (preg_match(
'/[\\+\\-]/', $sword)) {
121 $a_sword = explode(
' ', $sword);
123 $word = array_shift($a_sword);
125 $word = rtrim($word, $delchars);
129 $sword = implode(
' ', $a_sword);
132 preg_match(
'/^[^ ' . preg_quote($specchars,
'/') .
']*/', $sword, $reg);
134 $word = rtrim(trim($reg[0]), $delchars);
136 $sword = trim(preg_replace(
'/^' . preg_quote($reg[0],
'/') .
'/',
'', $sword));
149 protected static function getOperator($operator, $operatorTranslateTable)
151 $operator = trim($operator);
154 $operator = strtolower($operator);
155 foreach ($operatorTranslateTable as $key => $val) {
156 $item = $operatorTranslateTable[$key][0];
158 $item = strtolower($item);
159 if ($operator == $item) {
160 return $operatorTranslateTable[$key][1];