19 declare(strict_types=1);
61 $this->
lng = $DIC->language();
64 if (!defined(
'MIN_WORD_LENGTH')) {
65 define(
'MIN_WORD_LENGTH', self::MIN_WORD_LENGTH);
69 $this->query_str = $a_query_str;
79 $this->min_word_length = $a_length;
93 $this->global_min_length = $a_value;
103 $this->wildcards_allowed = $a_value;
113 $this->message = $a_msg;
122 $this->message .=
'<br />';
124 $this->message .= $a_msg;
129 $this->combination = $a_combination;
138 return trim($this->query_str);
146 return $this->words ?? array();
154 if ($with_quotation) {
155 return $this->quoted_words ?: [];
158 foreach ($this->quoted_words as $word) {
159 $tmp_word[] = str_replace(
"\"",
'', $word);
161 return $tmp_word ?? [];
178 $this->words = array();
182 foreach ($words as $word) {
183 if (!strlen(trim($word))) {
192 $this->words[] = $word;
196 if (!in_array($fullstr, $this->words)) {
197 $this->words[] = $fullstr;
202 foreach ($this->words as $idx => $word) {
203 if (!stristr($word,
'\\')) {
204 $word = str_replace(
'%',
'\%', $word);
205 $word = str_replace(
'_',
'\_', $word);
207 $this->words[$idx] = $word;
221 $this->quoted_words[] =
'';
225 while (preg_match(
"/\".*?\"/", $query_str, $matches)) {
226 $query_str = str_replace($matches[0],
'', $query_str);
227 $this->quoted_words[] = $matches[0];
231 $words = explode(
' ', trim($query_str));
232 foreach ($words as $word) {
233 if (!strlen(trim($word))) {
237 $this->quoted_words[] = $word;
242 foreach ($this->quoted_words as $idx => $word) {
243 if (!stristr($word,
'\\')) {
244 $word = str_replace(
'%',
'\%', $word);
245 $word = str_replace(
'_',
'\_', $word);
247 $this->quoted_words[$idx] = $word;
setGlobalMinLength(int $a_value)
setMinWordLength(int $a_length)
const MIN_WORD_LENGTH
Minimum of characters required for search.
__construct(string $a_query_str)
appendMessage(string $a_msg)
getQuotedWords(bool $with_quotation=false)
ilSearchSettings $settings
setMessage(string $a_msg)
setCombination(string $a_combination)
setAllowedWildcards(bool $a_value)