| @@ 51-67 (lines=17) @@ | ||
| 48 | /** |
|
| 49 | * {@inheritdoc} |
|
| 50 | */ |
|
| 51 | public function search($keywords, $filters = []) |
|
| 52 | { |
|
| 53 | $results = []; |
|
| 54 | ||
| 55 | foreach ($this->getSearchers() as $searcher) { |
|
| 56 | $results = array_merge( |
|
| 57 | $results, |
|
| 58 | $searcher->search($keywords, $filters) |
|
| 59 | ); |
|
| 60 | ||
| 61 | if (count($results) >= $this->getSatisfactionThreshold()) { |
|
| 62 | return array_slice($results, 0, $this->getSatisfactionThreshold()); |
|
| 63 | } |
|
| 64 | } |
|
| 65 | ||
| 66 | return $results; |
|
| 67 | } |
|
| 68 | ||
| 69 | /** |
|
| 70 | * {@inheritdoc} |
|
| @@ 72-88 (lines=17) @@ | ||
| 69 | /** |
|
| 70 | * {@inheritdoc} |
|
| 71 | */ |
|
| 72 | public function searchAndDecorate($keywords, $filters = []) |
|
| 73 | { |
|
| 74 | $results = []; |
|
| 75 | ||
| 76 | foreach ($this->getSearchers() as $searcher) { |
|
| 77 | $results = array_merge( |
|
| 78 | $results, |
|
| 79 | $searcher->searchAndDecorate($keywords, $filters) |
|
| 80 | ); |
|
| 81 | ||
| 82 | if (count($results) >= $this->getSatisfactionThreshold()) { |
|
| 83 | return array_slice($results, 0, $this->getSatisfactionThreshold()); |
|
| 84 | } |
|
| 85 | } |
|
| 86 | ||
| 87 | return $results; |
|
| 88 | } |
|
| 89 | ||
| 90 | /** |
|
| 91 | * {@inheritdoc} |
|