ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilAdvancedMDSearch.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
26{
28 protected ?ilADTSearchBridge $adt = null;
29
30 public function __construct($query_parser)
31 {
33 }
34
35 public function setDefinition(ilAdvancedMDFieldDefinition $a_def): void
36 {
37 $this->definition = $a_def;
38 }
39
41 {
42 return $this->definition;
43 }
44
45 public function setSearchElement(ilADTSearchBridge $a_adt): void
46 {
47 $this->adt = $a_adt;
48 }
49
51 {
52 return $this->adt;
53 }
54
55 public function performSearch(): ilSearchResult
56 {
57 $this->query_parser->parse();
58
59 $locate = '';
60 $parser_value = $this->getDefinition()->getSearchQueryParserValue($this->getSearchElement());
61 if ($parser_value) {
62 $this->setFields(
63 [
64 $this->getSearchElement()->getSearchColumn()
65 ]
66 );
67 $locate = $this->__createLocateString();
68 }
69
70 $search_type = strtolower(substr(get_class($this), 12, -6));
71
72 $res_field = $this->getDefinition()->searchObjects(
73 $this->getSearchElement(),
74 $this->query_parser,
75 $this->getFilter(),
76 $locate,
77 $search_type
78 );
79
80 if (is_array($res_field)) {
81 foreach ($res_field as $row) {
82 $found = is_array($row["found"] ?? null) ? $row["found"] : [];
83 $this->search_result->addEntry((int) $row["obj_id"], $row["type"], $found);
84 }
86 }
88 }
89}
ADT search bridge base class.
setFields(array $a_fields)
ilSearchResult $search_result
ilAdvancedMDFieldDefinition $definition
setDefinition(ilAdvancedMDFieldDefinition $a_def)
setSearchElement(ilADTSearchBridge $a_adt)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc