1 | <?php |
||
39 | class SearchService { |
||
40 | |||
41 | |||
42 | /** @var SearchMappingService */ |
||
43 | private $searchMappingService; |
||
44 | |||
45 | /** @var MiscService */ |
||
46 | private $miscService; |
||
47 | |||
48 | |||
49 | /** |
||
50 | * SearchService constructor. |
||
51 | * |
||
52 | * @param SearchMappingService $searchMappingService |
||
53 | * @param MiscService $miscService |
||
54 | */ |
||
55 | public function __construct( |
||
61 | |||
62 | |||
63 | // /** |
||
64 | // * @param Client $client |
||
65 | // * @param IFullTextSearchProvider $provider |
||
66 | // * @param DocumentAccess $access |
||
67 | // * @param SearchRequest $request |
||
68 | // * |
||
69 | // * @throws ConfigurationException |
||
70 | // * @throws Exception |
||
71 | // */ |
||
72 | // public function searchDocuments( |
||
73 | // Client $client, IFullTextSearchProvider $provider, DocumentAccess $access, |
||
74 | // SearchRequest $request |
||
75 | // ) { |
||
76 | // try { |
||
77 | // $query = $this->searchMappingService->generateSearchQuery($provider, $access, $request); |
||
78 | // } catch (SearchQueryGenerationException $e) { |
||
79 | // return null; |
||
80 | // } |
||
81 | // |
||
82 | // try { |
||
83 | // $result = $client->search($query['params']); |
||
84 | // } catch (Exception $e) { |
||
85 | // $this->miscService->log( |
||
86 | // 'debug - request: ' . json_encode($request) . ' - query: ' . json_encode($query) |
||
87 | // ); |
||
88 | // throw $e; |
||
89 | // } |
||
90 | // |
||
91 | // $searchResult = $this->generateSearchResultFromResult($result); |
||
92 | // |
||
93 | // foreach ($result['hits']['hits'] as $entry) { |
||
94 | // $searchResult->addDocument($this->parseSearchEntry($entry, $access->getViewerId())); |
||
95 | // } |
||
96 | // } |
||
97 | |||
98 | /** |
||
99 | * @param Client $client |
||
100 | * @param SearchResult $searchResult |
||
101 | * @param DocumentAccess $access |
||
102 | * |
||
103 | * @throws Exception |
||
104 | */ |
||
105 | public function searchRequest(Client $client, SearchResult $searchResult, DocumentAccess $access |
||
131 | // /** |
||
132 | // * @param Client $client |
||
133 | // * @param IFullTextSearchProvider $provider |
||
134 | // * @param DocumentAccess $access |
||
135 | // * @param SearchResult $result |
||
136 | // * |
||
137 | // * @return SearchResult |
||
138 | // * @throws ConfigurationException |
||
139 | // */ |
||
140 | // public function fillSearchResult( |
||
141 | // Client $client, IFullTextSearchProvider $provider, DocumentAccess $access, |
||
142 | // SearchResult $searchResult |
||
143 | // ) { |
||
144 | // try { |
||
145 | // $query = $this->searchMappingService->generateSearchQuery( |
||
146 | // $provider, $access, $searchResult->getRequest() |
||
147 | // ); |
||
148 | // } catch (SearchQueryGenerationException $e) { |
||
149 | // return null; |
||
150 | // } |
||
151 | // |
||
152 | // try { |
||
153 | // $result = $client->search($query['params']); |
||
154 | // } catch (Exception $e) { |
||
155 | // $this->miscService->log( |
||
156 | // 'debug - request: ' . json_encode($searchResult->getRequest()) . ' - query: ' |
||
157 | // . json_encode($query) |
||
158 | // ); |
||
159 | // throw $e; |
||
160 | // } |
||
161 | // |
||
162 | // $this->updateSearchResult($searchResult, $result); |
||
163 | // |
||
164 | // foreach ($result['hits']['hits'] as $entry) { |
||
165 | // $searchResult->addDocument($this->parseSearchEntry($entry, $access->getViewerId())); |
||
166 | // } |
||
167 | // |
||
168 | // return $searchResult; |
||
169 | // } |
||
170 | |||
171 | |||
172 | /** |
||
173 | * @param Client $client |
||
174 | * @param string $providerId |
||
175 | * @param string $documentId |
||
176 | * |
||
177 | * @return IndexDocument |
||
178 | * @throws ConfigurationException |
||
179 | */ |
||
180 | public function getDocument(Client $client, $providerId, $documentId) { |
||
204 | |||
205 | |||
206 | /** |
||
207 | * @param SearchResult $searchResult |
||
208 | * @param array $result |
||
209 | */ |
||
210 | private function updateSearchResult(SearchResult $searchResult, $result) { |
||
218 | |||
219 | |||
220 | /** |
||
221 | * @param array $entry |
||
222 | * @param string $viewerId |
||
223 | * |
||
224 | * @return IndexDocument |
||
225 | */ |
||
226 | private function parseSearchEntry($entry, $viewerId) { |
||
243 | |||
244 | |||
245 | } |
||
246 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: