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);
69 $this->parsed_query = trim($this->query_string);
70 if (stristr($this->parsed_query,
'*')) {
73 if (substr($this->parsed_query, -1) !==
'"') {
74 $this->parsed_query .=
'*';
93 if (isset($matches[2])) {
95 return $matches[1] . $usr_id;
111 #ilLuceneQueryParser::checkAllowedCharacters($a_query); 112 #ilLuceneQueryParser::checkAsterisk($a_query); 113 #ilLuceneQueryParser::checkAmpersands($a_query); 116 #ilLuceneQueryParser::checkExclamationMark($a_query); 117 #ilLuceneQueryParser::checkQuestionMark($a_query); 119 #ilLuceneQueryParser::checkPlusMinus($a_query); 120 #ilLuceneQueryParser::checkANDORNOT($a_query); 122 #ilLuceneQueryParser::checkColon($a_query); 132 if (preg_match(
'/[^\pL0-9_+\-:.()\"*?&§€|!{}\[\]\^~\\@#\/$%\'= ]/u',
$query) != 0) {
144 if (preg_match(
'/^[\*]*$|[\s]\*|^\*[^\s]/',
$query) != 0) {
156 if (preg_match(
'/[&]{2}/',
$query) > 0) {
157 if (preg_match(
'/^([\pL0-9_+\-:.()\"*?&|!{}\[\]\^~\\@#\/$%\'=]+( && )?[\pL0-9_+\-:.()\"*?|!{}\[\]\^~\\@#\/$%\'=]+[ ]*)+$/u',
$query) == 0) {
170 if (preg_match(
'/[^\\\]\^([^\s]*[^0-9.]+)|[^\\\]\^$/',
$query) != 0) {
182 if (preg_match(
'/[^\\\]*~[^\s]*[^0-9\s]+/',
$query, $matches) != 0) {
194 if (preg_match(
'/^[^!]*$|^([\pL0-9_+\-:.()\"*?&|!{}\[\]\^~\\@#\/$%\'=]+( ! )?[\pL0-9_+\-:.()\"*?&|!{}\[\]\^~\\@#\/$%\'=]+[ ]*)+$/u',
$query, $matches) == 0) {
206 if (preg_match(
'/^(\?)|([^\pL0-9_+\-:.()\"*?&|!{}\[\]\^~\\@#\/$%\'=]\?+)/u',
$query, $matches) != 0) {
226 if (($matchLft = preg_match_all(
'/[(]/', $a_query, $tmp)) > 0) {
229 if (($matchRgt = preg_match_all(
'/[)]/', $a_query, $tmp)) > 0) {
233 if (!$hasLft || !$hasRgt) {
238 if (($hasLft && !$hasRgt) || ($hasRgt && !$hasLft)) {
242 if ($matchLft !== $matchRgt) {
246 if (preg_match(
'/\(\s*\)/', $a_query) > 0) {
259 if (preg_match(
'/^[^\n+\-]*$|^([+-]?\s*[\pL0-9_:.()\"*?&|!{}\[\]\^~\\@#\/$%\'=]+[ ]?)+$/u', $a_query) == 0) {
274 if (preg_match(
'/^([\pL0-9_+\-:.()\"*?&|!{}\[\]\^~\\@\/#$%\'=]+\s*((AND )|(OR )|(AND NOT )|(NOT ))?[\pL0-9_+\-:.()\"*?&|!{}\[\]\^~\\@\/#$%\'=]+[ ]*)+$/u', $a_query) == 0) {
287 $matches = preg_match_all(
'/"/', $a_query, $tmp);
293 if (($matches % 2) > 0) {
297 if (preg_match(
'/"\s*"/', $a_query) > 0) {
311 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 !!!DIC refactoring-script warning...
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)
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.