19 declare(strict_types=1);
40 $this->query_string = $a_query_string;
49 $this->parsed_query = (string) preg_replace_callback(
50 '/(owner:)\s?([A-Za-z0-9_\.\+\*\@!\$\%\~\-]+)/',
51 array($this,
'replaceOwnerCallback'),
61 $this->parsed_query = trim($this->query_string);
62 if (stristr($this->parsed_query,
'*')) {
65 if (substr($this->parsed_query, -1) !==
'"') {
66 $this->parsed_query .=
'*';
80 if (isset($matches[2])) {
82 return $matches[1] . $usr_id;
95 #ilLuceneQueryParser::checkAllowedCharacters($a_query); 96 #ilLuceneQueryParser::checkAsterisk($a_query); 97 #ilLuceneQueryParser::checkAmpersands($a_query); 100 #ilLuceneQueryParser::checkExclamationMark($a_query); 101 #ilLuceneQueryParser::checkQuestionMark($a_query); 103 #ilLuceneQueryParser::checkPlusMinus($a_query); 104 #ilLuceneQueryParser::checkANDORNOT($a_query); 106 #ilLuceneQueryParser::checkColon($a_query); 116 if (preg_match(
'/[^\pL0-9_+\-:.()\"*?&§€|!{}\[\]\^~\\@#\/$%\'= ]/u', $query) != 0) {
128 if (preg_match(
'/^[\*]*$|[\s]\*|^\*[^\s]/', $query) != 0) {
140 if (preg_match(
'/[&]{2}/', $query) > 0) {
141 if (preg_match(
'/^([\pL0-9_+\-:.()\"*?&|!{}\[\]\^~\\@#\/$%\'=]+( && )?[\pL0-9_+\-:.()\"*?|!{}\[\]\^~\\@#\/$%\'=]+[ ]*)+$/u', $query) == 0) {
154 if (preg_match(
'/[^\\\]\^([^\s]*[^0-9.]+)|[^\\\]\^$/', $query) != 0) {
166 if (preg_match(
'/[^\\\]*~[^\s]*[^0-9\s]+/', $query, $matches) != 0) {
178 if (preg_match(
'/^[^!]*$|^([\pL0-9_+\-:.()\"*?&|!{}\[\]\^~\\@#\/$%\'=]+( ! )?[\pL0-9_+\-:.()\"*?&|!{}\[\]\^~\\@#\/$%\'=]+[ ]*)+$/u', $query, $matches) == 0) {
190 if (preg_match(
'/^(\?)|([^\pL0-9_+\-:.()\"*?&|!{}\[\]\^~\\@#\/$%\'=]\?+)/u', $query, $matches) != 0) {
210 if (($matchLft = preg_match_all(
'/[(]/', $a_query, $tmp)) > 0) {
213 if (($matchRgt = preg_match_all(
'/[)]/', $a_query, $tmp)) > 0) {
217 if (!$hasLft || !$hasRgt) {
222 if (($hasLft && !$hasRgt) || ($hasRgt && !$hasLft)) {
226 if ($matchLft !== $matchRgt) {
230 if (preg_match(
'/\(\s*\)/', $a_query) > 0) {
243 if (preg_match(
'/^[^\n+\-]*$|^([+-]?\s*[\pL0-9_:.()\"*?&|!{}\[\]\^~\\@#\/$%\'=]+[ ]?)+$/u', $a_query) == 0) {
256 if (preg_match(
'/^([\pL0-9_+\-:.()\"*?&|!{}\[\]\^~\\@\/#$%\'=]+\s*((AND )|(OR )|(AND NOT )|(NOT ))?[\pL0-9_+\-:.()\"*?&|!{}\[\]\^~\\@\/#$%\'=]+[ ]*)+$/u', $a_query) == 0) {
269 $matches = preg_match_all(
'/"/', $a_query, $tmp);
275 if (($matches % 2) > 0) {
279 if (preg_match(
'/"\s*"/', $a_query) > 0) {
292 if (preg_match(
'/[^\\\\s]:[\s]|[^\\\\s]:$|[\s][^\\]?:|^[^\\\\s]?:/', $a_query) != 0) {
replaceOwnerCallback(array $matches)
Replace owner callback (preg_replace_callback)
parse()
parse query string
static checkPlusMinus(string $a_query)
Check plus minus.
static checkQuotes(string $a_query)
Check quotes.
parseAutoWildcard()
Append asterisk for remote search from global search form field.
static checkColon(string $a_query)
Check colon.
static checkSquiggle(string $query)
Check squiggles.
static checkCaret(string $query)
Check carets.
static checkAllowedCharacters(string $query)
Check allowed characters.
static checkAsterisk(string $query)
Check asterisk.
static checkParenthesis(string $a_query)
Check parenthesis.
static _loginExists(string $a_login, int $a_user_id=0)
check if a login name already exists You may exclude a user from the check by giving his user id as 2...
static validateQuery($a_query)
static checkQuestionMark(string $query)
Check question mark (wild card single character)
static checkAmpersands(string $query)
Check ampersands.
static checkExclamationMark(string $query)
Check exclamation marks (replacement for NOT)
static checkANDORNOT(string $a_query)
Check AND OR NOT.
__construct($a_query_string)
Constructor.