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 | * For a given search engine entry point a SearchQueryRoute evaluates |
| 9 | * a particular SearchQuery and assign it a score. |
| 10 | * The SearchQueryDispatchService evaluates these scores and chose the best one |
| 11 | * in order to assign the profile context using the one provided by the route |
| 12 | * itself. |
| 13 | * SearchQueryRoutes are evaluated just after the SearchQuery is constructed |
| 14 | * and before ES query building components are chosen. |
| 15 | * @see \CirrusSearch\Profile\SearchProfileService |
| 16 | */ |
| 17 | interface SearchQueryRoute { |
| 18 | |
| 19 | /** |
| 20 | * Compute a score for this particular $query. |
| 21 | * Special values: |
| 22 | * - 0.0: this route must be avoided |
| 23 | * - 1.0: this route must supersede any others, the system |
| 24 | * fails if multiple routes return a score equals to 1 |
| 25 | * @param SearchQuery $query |
| 26 | * @return float a score between 0 and 1 |
| 27 | */ |
| 28 | public function score( SearchQuery $query ); |
| 29 | |
| 30 | /** |
| 31 | * The entry point used in the search engine: |
| 32 | * - searchText |
| 33 | * - nearMatch |
| 34 | * - completionSearch |
| 35 | * |
| 36 | * @return string |
| 37 | */ |
| 38 | public function getSearchEngineEntryPoint(); |
| 39 | |
| 40 | /** |
| 41 | * The SearchProfile context to use when this route is chosen. |
| 42 | * |
| 43 | * @return string |
| 44 | */ |
| 45 | public function getProfileContext(); |
| 46 | } |