24 include_once
'./Services/Search/classes/Lucene/class.ilLuceneQueryParserException.php';
48 $this->query_string = $a_query_string;
57 $this->parsed_query = preg_replace_callback(
'/(owner:)\s?([A-Za-z0-9_\.\+\*\@!\$\%\~\-]+)/',array($this,
'replaceOwnerCallback'),$this->query_string);
66 $this->parsed_query = trim($this->query_string);
67 if(stristr($this->parsed_query,
'*'))
71 if(substr($this->parsed_query, -1) !==
'"')
73 $this->parsed_query .=
'*';
92 if(isset($matches[2]))
96 return $matches[1].$usr_id;
112 #ilLuceneQueryParser::checkAllowedCharacters($a_query);
113 #ilLuceneQueryParser::checkAsterisk($a_query);
114 #ilLuceneQueryParser::checkAmpersands($a_query);
117 #ilLuceneQueryParser::checkExclamationMark($a_query);
118 #ilLuceneQueryParser::checkQuestionMark($a_query);
120 #ilLuceneQueryParser::checkPlusMinus($a_query);
121 #ilLuceneQueryParser::checkANDORNOT($a_query);
123 #ilLuceneQueryParser::checkColon($a_query);
133 if(preg_match(
'/[^\pL0-9_+\-:.()\"*?&§€|!{}\[\]\^~\\@#\/$%\'= ]/u',
$query) != 0)
146 if(preg_match(
'/^[\*]*$|[\s]\*|^\*[^\s]/',
$query) != 0)
159 if(preg_match(
'/[&]{2}/',
$query) > 0)
161 if(preg_match(
'/^([\pL0-9_+\-:.()\"*?&|!{}\[\]\^~\\@#\/$%\'=]+( && )?[\pL0-9_+\-:.()\"*?|!{}\[\]\^~\\@#\/$%\'=]+[ ]*)+$/u',
$query) == 0)
175 if(preg_match(
'/[^\\\]\^([^\s]*[^0-9.]+)|[^\\\]\^$/',
$query) != 0)
188 if(preg_match(
'/[^\\\]*~[^\s]*[^0-9\s]+/',
$query,$matches) != 0)
201 if(preg_match(
'/^[^!]*$|^([\pL0-9_+\-:.()\"*?&|!{}\[\]\^~\\@#\/$%\'=]+( ! )?[\pL0-9_+\-:.()\"*?&|!{}\[\]\^~\\@#\/$%\'=]+[ ]*)+$/u',
$query,$matches) == 0)
214 if(preg_match(
'/^(\?)|([^\pL0-9_+\-:.()\"*?&|!{}\[\]\^~\\@#\/$%\'=]\?+)/u',
$query,$matches) != 0)
235 if(($matchLft = preg_match_all(
'/[(]/',$a_query,$tmp)) > 0)
239 if(($matchRgt = preg_match_all(
'/[)]/',$a_query,$tmp)) > 0)
244 if(!$hasLft || !$hasRgt)
250 if(($hasLft && !$hasRgt) || ($hasRgt && !$hasLft))
255 if($matchLft !== $matchRgt)
260 if(preg_match(
'/\(\s*\)/',$a_query) > 0)
274 if(preg_match(
'/^[^\n+\-]*$|^([+-]?\s*[\pL0-9_:.()\"*?&|!{}\[\]\^~\\@#\/$%\'=]+[ ]?)+$/u',$a_query) == 0)
290 if(preg_match(
'/^([\pL0-9_+\-:.()\"*?&|!{}\[\]\^~\\@\/#$%\'=]+\s*((AND )|(OR )|(AND NOT )|(NOT ))?[\pL0-9_+\-:.()\"*?&|!{}\[\]\^~\\@\/#$%\'=]+[ ]*)+$/u',$a_query) == 0)
304 $matches = preg_match_all(
'/"/',$a_query,$tmp);
311 if(($matches % 2) > 0)
316 if(preg_match(
'/"\s*"/',$a_query) > 0)
331 if(preg_match(
'/[^\\\\s]:[\s]|[^\\\\s]:$|[\s][^\\]?:|^[^\\\\s]?:/',$a_query) != 0)