35define(
'QP_COMBINATION_AND',
'and');
36define(
'QP_COMBINATION_OR',
'or');
65 define(
'MIN_WORD_LENGTH',self::MIN_WORD_LENGTH);
69 $this->query_str = $a_query_str;
72 include_once
'./Services/Search/classes/class.ilSearchSettings.php';
88 if(!$a_force and $this->
settings->enabledIndex() and $a_length < 3)
93 $this->min_word_length = $a_length;
103 if($a_value !==
null)
105 $a_value = (int)$a_value;
111 $this->global_min_length = $a_value;
121 $this->wildcards_allowed = (bool)$a_value;
131 $this->message = $a_msg;
141 $this->message .=
'<br />';
143 $this->message .= $a_msg;
148 $this->combination = $a_combination;
157 return trim($this->query_str);
161 return $this->words ? $this->words : array();
168 return $this->quoted_words ? $this->quoted_words : array();
172 foreach($this->quoted_words as $word)
174 $tmp_word[] = str_replace(
'\"',
'',$word);
176 return $tmp_word ? $tmp_word : array();
195 $this->words = array();
197 #if(!strlen($this->getQueryString()))
203 foreach($words as $word)
205 if(!strlen(trim($word)))
212 $this->
setMessage(
sprintf($this->lng->txt(
'search_minimum_info'), $this->getMinWordLength()));
220 if (!in_array($fullstr, $this->words))
228 foreach($this->words as $idx => $word)
230 if(!stristr($word,
'\\'))
232 $word = str_replace(
'%',
'\%', $word);
233 $word = str_replace(
'_',
'\_', $word);
235 $this->words[$idx] = $word;
250 $this->quoted_words[] =
'';
254 while(preg_match(
"/\".*?\"/",
$query_str,$matches))
262 foreach($words as $word)
264 if(!strlen(trim($word)))
275 foreach($this->quoted_words as $idx => $word)
277 if(!stristr($word,
'\\'))
279 $word = str_replace(
'%',
'\%', $word);
280 $word = str_replace(
'_',
'\_', $word);
282 $this->quoted_words[$idx] = $word;
297 $this->
setMessage($this->lng->txt(
'msg_no_search_string'));
303 $this->
setMessage(
sprintf($this->lng->txt(
'search_minimum_info'), $this->getGlobalMinLength()));
sprintf('%.4f', $callTime)
An exception for terminatinating execution or to throw for unit testing.
static getLogger($a_component_id)
Get component logger.
__construct($a_query_str)
Constructor @access public.
setMinWordLength($a_length, $a_force=false)
setCombination($a_combination)
const MIN_WORD_LENGTH
Minimum of characters required for search.
getQuotedWords($with_quotation=false)
setAllowedWildcards($a_value)
setGlobalMinLength($a_value)
static prepareDBString($a_str)
prepare a string for db writing (insert/update)