Lucene query parser.
More...
◆ __construct()
ilLuceneQueryParser::__construct |
( |
|
$a_query_string | ) |
|
◆ checkAllowedCharacters()
static ilLuceneQueryParser::checkAllowedCharacters |
( |
string |
$query | ) |
|
|
staticprotected |
Check allowed characters.
- Exceptions
-
Definition at line 114 of file class.ilLuceneQueryParser.php.
116 if (preg_match(
'/[^\pL0-9_+\-:.()\"*?&§€|!{}\[\]\^~\\@#\/$%\'= ]/u', $query) != 0) {
◆ checkAmpersands()
static ilLuceneQueryParser::checkAmpersands |
( |
string |
$query | ) |
|
|
staticprotected |
Check ampersands.
- Exceptions
-
Definition at line 138 of file class.ilLuceneQueryParser.php.
140 if (preg_match(
'/[&]{2}/', $query) > 0) {
141 if (preg_match(
'/^([\pL0-9_+\-:.()\"*?&|!{}\[\]\^~\\@#\/$%\'=]+( && )?[\pL0-9_+\-:.()\"*?|!{}\[\]\^~\\@#\/$%\'=]+[ ]*)+$/u', $query) == 0) {
◆ checkANDORNOT()
static ilLuceneQueryParser::checkANDORNOT |
( |
string |
$a_query | ) |
|
|
staticprotected |
Check AND OR NOT.
- Exceptions
-
Definition at line 254 of file class.ilLuceneQueryParser.php.
256 if (preg_match(
'/^([\pL0-9_+\-:.()\"*?&|!{}\[\]\^~\\@\/#$%\'=]+\s*((AND )|(OR )|(AND NOT )|(NOT ))?[\pL0-9_+\-:.()\"*?&|!{}\[\]\^~\\@\/#$%\'=]+[ ]*)+$/u', $a_query) == 0) {
◆ checkAsterisk()
static ilLuceneQueryParser::checkAsterisk |
( |
string |
$query | ) |
|
|
staticprotected |
◆ checkCaret()
static ilLuceneQueryParser::checkCaret |
( |
string |
$query | ) |
|
|
staticprotected |
◆ checkColon()
static ilLuceneQueryParser::checkColon |
( |
string |
$a_query | ) |
|
|
staticprotected |
Check colon.
- Exceptions
-
Definition at line 290 of file class.ilLuceneQueryParser.php.
292 if (preg_match(
'/[^\\\\s]:[\s]|[^\\\\s]:$|[\s][^\\]?:|^[^\\\\s]?:/', $a_query) != 0) {
◆ checkExclamationMark()
static ilLuceneQueryParser::checkExclamationMark |
( |
string |
$query | ) |
|
|
staticprotected |
Check exclamation marks (replacement for NOT)
- Exceptions
-
Definition at line 176 of file class.ilLuceneQueryParser.php.
178 if (preg_match(
'/^[^!]*$|^([\pL0-9_+\-:.()\"*?&|!{}\[\]\^~\\@#\/$%\'=]+( ! )?[\pL0-9_+\-:.()\"*?&|!{}\[\]\^~\\@#\/$%\'=]+[ ]*)+$/u', $query, $matches) == 0) {
◆ checkParenthesis()
static ilLuceneQueryParser::checkParenthesis |
( |
string |
$a_query | ) |
|
|
staticprotected |
Check parenthesis.
- Exceptions
-
Definition at line 200 of file class.ilLuceneQueryParser.php.
Referenced by validateQuery().
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) {
◆ checkPlusMinus()
static ilLuceneQueryParser::checkPlusMinus |
( |
string |
$a_query | ) |
|
|
staticprotected |
Check plus minus.
- Exceptions
-
Definition at line 241 of file class.ilLuceneQueryParser.php.
243 if (preg_match(
'/^[^\n+\-]*$|^([+-]?\s*[\pL0-9_:.()\"*?&|!{}\[\]\^~\\@#\/$%\'=]+[ ]?)+$/u', $a_query) == 0) {
◆ checkQuestionMark()
static ilLuceneQueryParser::checkQuestionMark |
( |
string |
$query | ) |
|
|
staticprotected |
Check question mark (wild card single character)
- Exceptions
-
Definition at line 188 of file class.ilLuceneQueryParser.php.
190 if (preg_match(
'/^(\?)|([^\pL0-9_+\-:.()\"*?&|!{}\[\]\^~\\@#\/$%\'=]\?+)/u', $query, $matches) != 0) {
◆ checkQuotes()
static ilLuceneQueryParser::checkQuotes |
( |
string |
$a_query | ) |
|
|
staticprotected |
Check quotes.
- Exceptions
-
Definition at line 267 of file class.ilLuceneQueryParser.php.
Referenced by validateQuery().
269 $matches = preg_match_all(
'/"/', $a_query, $tmp);
275 if (($matches % 2) > 0) {
279 if (preg_match(
'/"\s*"/', $a_query) > 0) {
◆ checkSquiggle()
static ilLuceneQueryParser::checkSquiggle |
( |
string |
$query | ) |
|
|
staticprotected |
◆ getQuery()
ilLuceneQueryParser::getQuery |
( |
| ) |
|
◆ parse()
ilLuceneQueryParser::parse |
( |
| ) |
|
◆ parseAutoWildcard()
ilLuceneQueryParser::parseAutoWildcard |
( |
| ) |
|
Append asterisk for remote search from global search form field.
Definition at line 59 of file class.ilLuceneQueryParser.php.
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 .=
'*';
◆ replaceOwnerCallback()
ilLuceneQueryParser::replaceOwnerCallback |
( |
array |
$matches | ) |
|
|
protected |
Replace owner callback (preg_replace_callback)
Definition at line 78 of file class.ilLuceneQueryParser.php.
References ilObjUser\_loginExists().
80 if (isset($matches[2])) {
82 return $matches[1] . $usr_id;
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...
◆ validateQuery()
static ilLuceneQueryParser::validateQuery |
( |
|
$a_query | ) |
|
|
static |
◆ $parsed_query
string ilLuceneQueryParser::$parsed_query = '' |
|
protected |
◆ $query_string
string ilLuceneQueryParser::$query_string |
|
protected |
The documentation for this class was generated from the following file: