|
25 | 25 |
|
26 | 26 | class SearchRequest implements Request, HasFilter
|
27 | 27 | {
|
| 28 | + const PAGESIZE_ALL = 99999; |
28 | 29 | /**
|
29 | 30 | * @var $resource ResourceFacade
|
30 | 31 | */
|
@@ -103,20 +104,18 @@ public function doRequest($activeFilterAttributeCodes = array())
|
103 | 104 | $pageSize = $this->getParamsBuilder()->getPageSize() * $this->getParamsBuilder()->getCurrentPage();
|
104 | 105 | $isFuzzyActive = $this->fuzzyConfig->isActive();
|
105 | 106 | $minimumResults = $this->fuzzyConfig->getMinimumResults();
|
106 |
| - if ($this->getCurrentSort() != 'position') { |
| 107 | + if ($this->getCurrentSort() !== 'position') { |
107 | 108 | $result = $this->getResultFromRequest($pageSize, $isFuzzyActive, $activeFilterAttributeCodes);
|
108 | 109 | return $this->sliceResult($result);
|
109 | 110 | } else {
|
110 |
| - $result = $this->getResultFromRequest(99999, false, $activeFilterAttributeCodes); |
111 |
| - |
112 |
| - $numberResults = sizeof($result->response->docs); |
| 111 | + $result = $this->getResultFromRequest($isFuzzyActive ? self::PAGESIZE_ALL : $pageSize, false, $activeFilterAttributeCodes); |
| 112 | + $numberResults = $result->documents()->count() ; |
113 | 113 | if ($isFuzzyActive && (($minimumResults == 0) || ($numberResults < $minimumResults))) {
|
114 | 114 |
|
115 |
| - $fuzzyResult = $this->getResultFromRequest(99999, true, $activeFilterAttributeCodes); |
| 115 | + $fuzzyResult = $this->getResultFromRequest(self::PAGESIZE_ALL, true, $activeFilterAttributeCodes); |
116 | 116 | $result = $result->merge($fuzzyResult, $pageSize);
|
117 | 117 | }
|
118 |
| - |
119 |
| - if (sizeof($result->response->docs) == 0) { |
| 118 | + if ($result->documents()->count() === 0) { |
120 | 119 | $this->foundNoResults = true;
|
121 | 120 | $check = explode(' ', $this->queryBuilder->getSearchString()->getRawString());
|
122 | 121 | if (count($check) > 1) {
|
|
0 commit comments