ILIAS  trunk Revision v11.0_alpha-1744-gb0451eebef4
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilMailLuceneQueryParser Class Reference
+ Inheritance diagram for ilMailLuceneQueryParser:
+ Collaboration diagram for ilMailLuceneQueryParser:

Public Member Functions

 parse ()
 
 setFields (array $fields)
 Set the fields to query for ILIAS 10: the values are not boolean, but different query strings for the fields. More...
 
 getFields ()
 Get the fields to query for ILIAS 10 the values are not boolean, but different query strings for the fields. More...
 
- Public Member Functions inherited from ilLuceneQueryParser
 __construct ($a_query_string)
 Constructor. More...
 
 parse ()
 parse query string More...
 
 parseAutoWildcard ()
 Append asterisk for remote search from global search form field. More...
 
 getQuery ()
 

Private Attributes

array $fields = []
 

Additional Inherited Members

- Static Public Member Functions inherited from ilLuceneQueryParser
static validateQuery ($a_query)
 
- Protected Member Functions inherited from ilLuceneQueryParser
 replaceOwnerCallback (array $matches)
 Replace owner callback (preg_replace_callback) More...
 
- Static Protected Member Functions inherited from ilLuceneQueryParser
static checkAllowedCharacters (string $query)
 Check allowed characters. More...
 
static checkAsterisk (string $query)
 Check asterisk. More...
 
static checkAmpersands (string $query)
 Check ampersands. More...
 
static checkCaret (string $query)
 Check carets. More...
 
static checkSquiggle (string $query)
 Check squiggles. More...
 
static checkExclamationMark (string $query)
 Check exclamation marks (replacement for NOT) More...
 
static checkQuestionMark (string $query)
 Check question mark (wild card single character) More...
 
static checkParenthesis (string $a_query)
 Check parenthesis. More...
 
static checkPlusMinus (string $a_query)
 Check plus minus. More...
 
static checkANDORNOT (string $a_query)
 Check AND OR NOT. More...
 
static checkQuotes (string $a_query)
 Check quotes. More...
 
static checkColon (string $a_query)
 Check colon. More...
 
- Protected Attributes inherited from ilLuceneQueryParser
string $query_string
 
string $parsed_query = ''
 

Detailed Description

Definition at line 21 of file class.ilMailLuceneQueryParser.php.

Member Function Documentation

◆ getFields()

ilMailLuceneQueryParser::getFields ( )

Get the fields to query for ILIAS 10 the values are not boolean, but different query strings for the fields.

Returns
array{'title': ?string, 'content': ?string, 'mattachment': ?string, 'msender': ?string}|array{}

Definition at line 78 of file class.ilMailLuceneQueryParser.php.

References $fields.

Referenced by parse().

78  : array
79  {
80  return $this->fields;
81  }
+ Here is the caller graph for this function:

◆ parse()

ilMailLuceneQueryParser::parse ( )

Definition at line 26 of file class.ilMailLuceneQueryParser.php.

References ilLuceneQueryParser\$query_string, $token, getFields(), ilSearchSettings\getInstance(), and ilSearchSettings\OPERATOR_AND.

26  : void
27  {
28  if (!empty($this->getFields())) {
29  $queried_fields = [];
30  $token_operator = ' OR ';
31  if (ilSearchSettings::getInstance()->getDefaultOperator() === ilSearchSettings::OPERATOR_AND) {
32  $token_operator = ' AND ';
33  }
34 
35  // ILIAS 10: each filter field has now its own query string
36  foreach ($this->getFields() as $field => $query_string) {
37  if (empty($query_string)) {
38  continue;
39  }
40 
41  $field_query = '';
42  $tokens = array_map(trim(...), explode(' ', $query_string));
43  foreach ($tokens as $token) {
44  if ($field_query !== '') {
45  $field_query .= $token_operator;
46  }
47  $field_query .= '(' . $field . ':' . $token . ')';
48  }
49 
50  $queried_fields[] = '(' . $field_query . ')';
51  }
52 
53  if ($queried_fields !== []) {
54  $this->parsed_query = implode(' OR ', $queried_fields);
55  return;
56  }
57  }
58 
59  parent::parse();
60  }
$token
Definition: xapitoken.php:70
getFields()
Get the fields to query for ILIAS 10 the values are not boolean, but different query strings for the ...
+ Here is the call graph for this function:

◆ setFields()

ilMailLuceneQueryParser::setFields ( array  $fields)

Set the fields to query for ILIAS 10: the values are not boolean, but different query strings for the fields.

Parameters
array{'title'?string, 'content': ?string, 'mattachment': ?string, 'msender': ?string}|array{} $fields

Definition at line 68 of file class.ilMailLuceneQueryParser.php.

References $fields.

68  : void
69  {
70  $this->fields = $fields;
71  }

Field Documentation

◆ $fields

array ilMailLuceneQueryParser::$fields = []
private

Definition at line 24 of file class.ilMailLuceneQueryParser.php.

Referenced by getFields(), and setFields().


The documentation for this class was generated from the following file: