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)
static checkAllowedCharacters($query)
Check allowed characters.
static checkSquiggle($query)
Check squiggles.
parse()
parse query string
static checkAmpersands($query)
Check ampersands.
static checkCaret($query)
Check carets.
static checkPlusMinus($a_query)
Check plus minus.
parseAutoWildcard()
Append asterisk for remote search from global search form field.
static _loginExists($a_login, $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 checkQuestionMark($query)
Check question mark (wild card single character)
static checkQuotes($a_query)
Check quotes.
static checkANDORNOT($a_query)
Check AND OR NOT.
static validateQuery($a_query)
Create styles array
The data for the language used.
static checkAsterisk($query)
Check asterisk.
static checkColon($a_query)
Check colon.
replaceOwnerCallback($matches)
Replace owner callback (preg_replace_callback)
static checkParenthesis($a_query)
Check parenthesis.
static checkExclamationMark($query)
Check exclamation marks (replacement for NOT)
__construct($a_query_string)
Constructor.