35 define(
'QP_COMBINATION_AND',
'and');
36 define(
'QP_COMBINATION_OR',
'or');
67 define(
'MIN_WORD_LENGTH', self::MIN_WORD_LENGTH);
71 $this->query_str = $a_query_str;
74 include_once
'./Services/Search/classes/class.ilSearchSettings.php';
89 if (!$a_force
and $this->
settings->enabledIndex()
and $a_length < 3) {
93 $this->min_word_length = $a_length;
103 if ($a_value !== null) {
104 $a_value = (int) $a_value;
109 $this->global_min_length = $a_value;
119 $this->wildcards_allowed = (bool) $a_value;
129 $this->message = $a_msg;
138 $this->message .=
'<br />';
140 $this->message .= $a_msg;
145 $this->combination = $a_combination;
154 return trim($this->query_str);
158 return $this->words ? $this->words : array();
163 if ($with_quotation) {
164 return $this->quoted_words ? $this->quoted_words : array();
166 foreach ($this->quoted_words as $word) {
167 $tmp_word[] = str_replace(
'\"',
'', $word);
169 return $tmp_word ? $tmp_word : array();
187 $this->words = array();
189 #if(!strlen($this->getQueryString())) 195 foreach ($words as $word) {
196 if (!strlen(trim($word))) {
209 if (!in_array($fullstr, $this->words)) {
215 foreach ($this->words as $idx => $word) {
216 if (!stristr($word,
'\\')) {
217 $word = str_replace(
'%',
'\%', $word);
218 $word = str_replace(
'_',
'\_', $word);
220 $this->words[$idx] = $word;
234 $this->quoted_words[] =
'';
238 while (preg_match(
"/\".*?\"/",
$query_str, $matches)) {
245 foreach ($words as $word) {
246 if (!strlen(trim($word))) {
255 foreach ($this->quoted_words as $idx => $word) {
256 if (!stristr($word,
'\\')) {
257 $word = str_replace(
'%',
'\%', $word);
258 $word = str_replace(
'_',
'\_', $word);
260 $this->quoted_words[$idx] = $word;
273 $this->
setMessage($this->lng->txt(
'msg_no_search_string'));
getQuotedWords($with_quotation=false)
const MIN_WORD_LENGTH
Minimum of characters required for search.
__construct($a_query_str)
Constructor public.
setGlobalMinLength($a_value)
static prepareDBString($a_str)
prepare a string for db writing (insert/update)
setCombination($a_combination)
static getLogger($a_component_id)
Get component logger.
setMinWordLength($a_length, $a_force=false)
setAllowedWildcards($a_value)