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,
'*')) {
70 if (substr($this->parsed_query, -1) !==
'"') {
71 $this->parsed_query .=
'*';
90 if (isset($matches[2])) {
92 return $matches[1] . $usr_id;
108 #ilLuceneQueryParser::checkAllowedCharacters($a_query); 109 #ilLuceneQueryParser::checkAsterisk($a_query); 110 #ilLuceneQueryParser::checkAmpersands($a_query); 113 #ilLuceneQueryParser::checkExclamationMark($a_query); 114 #ilLuceneQueryParser::checkQuestionMark($a_query); 116 #ilLuceneQueryParser::checkPlusMinus($a_query); 117 #ilLuceneQueryParser::checkANDORNOT($a_query); 119 #ilLuceneQueryParser::checkColon($a_query); 129 if (preg_match(
'/[^\pL0-9_+\-:.()\"*?&§€|!{}\[\]\^~\\@#\/$%\'= ]/u',
$query) != 0) {
141 if (preg_match(
'/^[\*]*$|[\s]\*|^\*[^\s]/',
$query) != 0) {
153 if (preg_match(
'/[&]{2}/',
$query) > 0) {
154 if (preg_match(
'/^([\pL0-9_+\-:.()\"*?&|!{}\[\]\^~\\@#\/$%\'=]+( && )?[\pL0-9_+\-:.()\"*?|!{}\[\]\^~\\@#\/$%\'=]+[ ]*)+$/u',
$query) == 0) {
167 if (preg_match(
'/[^\\\]\^([^\s]*[^0-9.]+)|[^\\\]\^$/',
$query) != 0) {
179 if (preg_match(
'/[^\\\]*~[^\s]*[^0-9\s]+/',
$query, $matches) != 0) {
191 if (preg_match(
'/^[^!]*$|^([\pL0-9_+\-:.()\"*?&|!{}\[\]\^~\\@#\/$%\'=]+( ! )?[\pL0-9_+\-:.()\"*?&|!{}\[\]\^~\\@#\/$%\'=]+[ ]*)+$/u',
$query, $matches) == 0) {
203 if (preg_match(
'/^(\?)|([^\pL0-9_+\-:.()\"*?&|!{}\[\]\^~\\@#\/$%\'=]\?+)/u',
$query, $matches) != 0) {
223 if (($matchLft = preg_match_all(
'/[(]/', $a_query, $tmp)) > 0) {
226 if (($matchRgt = preg_match_all(
'/[)]/', $a_query, $tmp)) > 0) {
230 if (!$hasLft || !$hasRgt) {
235 if (($hasLft && !$hasRgt) || ($hasRgt && !$hasLft)) {
239 if ($matchLft !== $matchRgt) {
243 if (preg_match(
'/\(\s*\)/', $a_query) > 0) {
256 if (preg_match(
'/^[^\n+\-]*$|^([+-]?\s*[\pL0-9_:.()\"*?&|!{}\[\]\^~\\@#\/$%\'=]+[ ]?)+$/u', $a_query) == 0) {
271 if (preg_match(
'/^([\pL0-9_+\-:.()\"*?&|!{}\[\]\^~\\@\/#$%\'=]+\s*((AND )|(OR )|(AND NOT )|(NOT ))?[\pL0-9_+\-:.()\"*?&|!{}\[\]\^~\\@\/#$%\'=]+[ ]*)+$/u', $a_query) == 0) {
284 $matches = preg_match_all(
'/"/', $a_query, $tmp);
290 if (($matches % 2) > 0) {
294 if (preg_match(
'/"\s*"/', $a_query) > 0) {
308 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.