Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
|||
| 1 | <?php |
| 2 | |
| 3 | namespace CirrusSearch\Dispatch; |
| 4 | |
| 5 | use CirrusSearch\Search\SearchQuery; |
| 6 | |
| 7 | /** |
| 8 | * The Search query dispatch service. |
| 9 | * Based on a SearchQuery and the SearchQueryRoute that have been |
| 10 | * declared find the best possible route for this query. |
| 11 | * |
| 12 | * All routes are evaluated the best one is returned. |
| 13 | * - If multiple routes gives equal score the first one wins |
| 14 | * - If multiple routes give the max score of 1 then the system fails |
| 15 | * - If no routes is found the system fails |
| 16 | * |
| 17 | * @see SearchQueryRoute |
| 18 | */ |
| 19 | interface SearchQueryDispatchService { |
| 20 | /** |
| 21 | * Score used by cirrus defaults. |
| 22 | * Anything below is unlikely to be selected as cirrus defaults |
| 23 | * are made to catchup all query types. |
| 24 | */ |
| 25 | public const CIRRUS_DEFAULTS_SCORE = 0.0001; |
| 26 | |
| 27 | /** |
| 28 | * Determine the best route for the $query. |
| 29 | * |
| 30 | * @param SearchQuery $query |
| 31 | * @return SearchQueryRoute |
| 32 | */ |
| 33 | public function bestRoute( SearchQuery $query ): SearchQueryRoute; |
| 34 | } |