1 | <?php declare(strict_types = 1); |
||
35 | class StatisticsRepository extends AbstractRepository |
||
36 | { |
||
37 | /** |
||
38 | * @var string |
||
39 | */ |
||
40 | protected $table = 'tx_solr_statistics'; |
||
41 | |||
42 | /** |
||
43 | 1 | * Fetches must popular search keys words from the table tx_solr_statistics |
|
44 | * |
||
45 | 1 | * @param int $rootPageId |
|
46 | 1 | * @param int $days number of days of history to query |
|
47 | 1 | * @param int $limit |
|
48 | 1 | * @return mixed |
|
49 | */ |
||
50 | 1 | public function getSearchStatistics(int $rootPageId, int $days = 30, $limit = 10) |
|
59 | 1 | ||
60 | /** |
||
61 | 1 | * Returns prepared QueryBuilder for two purposes: |
|
62 | 1 | * for getSearchStatistics() and getTopKeyWordsWithOrWithoutHits() methods |
|
63 | * |
||
64 | * @param int $rootPageId |
||
65 | * @param int $timeStart |
||
66 | 1 | * @param int $limit |
|
67 | * @return QueryBuilder |
||
68 | */ |
||
69 | 1 | protected function getPreparedQueryBuilderForSearchStatisticsAndTopKeywords(int $rootPageId, int $timeStart, int $limit) : QueryBuilder |
|
91 | |||
92 | /** |
||
93 | * Find Top search keywords with results |
||
94 | * |
||
95 | 2 | * @param int $rootPageId |
|
96 | * @param int $days number of days of history to query |
||
97 | 2 | * @param int $limit |
|
98 | * @return array |
||
99 | */ |
||
100 | public function getTopKeyWordsWithHits(int $rootPageId, int $days = 30, int $limit = 10) : array |
||
104 | |||
105 | /** |
||
106 | * Find Top search keywords without results |
||
107 | * |
||
108 | * @param int $rootPageId |
||
109 | 3 | * @param int $days number of days of history to query |
|
110 | * @param int $limit |
||
111 | 3 | * @return array |
|
112 | 3 | */ |
|
113 | 3 | public function getTopKeyWordsWithoutHits(int $rootPageId, int $days = 30, int $limit = 10) : array |
|
117 | |||
118 | /** |
||
119 | 3 | * Find Top search keywords with or without results |
|
120 | 2 | * |
|
121 | * @param int $rootPageId |
||
122 | 1 | * @param int $days number of days of history to query |
|
123 | * @param int $limit |
||
124 | * @param bool $withoutHits |
||
125 | 3 | * @return array |
|
126 | 3 | */ |
|
127 | 3 | protected function getTopKeyWordsWithOrWithoutHits(int $rootPageId, int $days = 30, int $limit = 10, bool $withoutHits = false) : array |
|
142 | |||
143 | /** |
||
144 | * Get number of queries over time |
||
145 | * |
||
146 | 4 | * @param int $rootPageId |
|
147 | * @param int $days number of days of history to query |
||
148 | 4 | * @param int $bucketSeconds Seconds per bucket |
|
149 | 4 | * @return array [labels, data] |
|
150 | 2 | */ |
|
151 | public function getQueriesOverTime(int $rootPageId, int $days = 30, int $bucketSeconds = 3600) : array |
||
174 | |||
175 | /** |
||
176 | * Regurns a result set by given plugin.tx_solr.search.frequentSearches.select configuration. |
||
177 | * |
||
178 | * @param array $frequentSearchConfiguration |
||
179 | * @return array Array of frequent search terms, keys are the terms, values are hits |
||
180 | */ |
||
181 | public function getFrequentSearchTermsFromStatisticsByFrequentSearchConfiguration(array $frequentSearchConfiguration) : array |
||
197 | |||
198 | /** |
||
199 | * Persists statistics record |
||
200 | * |
||
201 | 2 | * @param array $statisticsRecord |
|
202 | * @return void |
||
203 | */ |
||
204 | 2 | public function saveStatisticsRecord(array $statisticsRecord) |
|
209 | 1 | ||
210 | 1 | /** |
|
211 | 1 | * Counts rows for specified site |
|
212 | 1 | * |
|
213 | 1 | * @param int $rootPageId |
|
214 | * @return int |
||
215 | */ |
||
216 | public function countByRootPageId(int $rootPageId): int |
||
225 | } |
||
226 |