ILIAS  trunk Revision v11.0_alpha-1689-g66c127b4ae8
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
class.ilLuceneAdvancedQueryParser.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
30 {
35  protected $query_data;
36 
40  public function __construct($a_query_data)
41  {
43 
44  $this->field_definition = ilLuceneAdvancedSearchFields::getInstance();
45  $this->query_data = $a_query_data;
46  }
47 
52  {
54  }
55 
59  public function getQueryData()
60  {
61  if (is_array($this->query_data)) {
62  return $this->query_data;
63  }
64  return $this->query_data ?? '';
65  }
66 
67  public function parse(): void
68  {
69  foreach ((array) $this->getQueryData() as $field => $query) {
70  if (!is_array($query) && !trim((string) $query)) {
71  continue;
72  }
73  $parsed = $this->getFieldDefinition()->parseFieldQuery((string) $field, $query);
74  if (strlen($parsed)) {
75  $this->parsed_query .= " +(";
76  $this->parsed_query .= $parsed;
77  $this->parsed_query .= ") ";
78  }
79  }
80  }
81 }
getFieldDefinition()
Get field definition settings.
ilLuceneAdvancedSearchFields $field_definition
__construct(Container $dic, ilPlugin $plugin)
Field definitions of advanced meta data search.