1 | <?php |
||
35 | class SolrReadService extends AbstractSolrService |
||
36 | { |
||
37 | |||
38 | /** |
||
39 | * @var bool |
||
40 | */ |
||
41 | protected $hasSearched = false; |
||
42 | |||
43 | /** |
||
44 | * @var \Apache_Solr_Response |
||
45 | */ |
||
46 | protected $responseCache = null; |
||
47 | |||
48 | |||
49 | /** |
||
50 | * @var string |
||
51 | */ |
||
52 | protected $_extractUrl; |
||
53 | |||
54 | /** |
||
55 | * Performs a search. |
||
56 | * |
||
57 | * @param string $query query string / search term |
||
58 | * @param int $offset result offset for pagination |
||
59 | * @param int $limit number of results to retrieve |
||
60 | * @param array $params additional HTTP GET parameters |
||
61 | * @param string $method The HTTP method (Apache_Solr_Service::METHOD_GET or Apache_Solr_Service::METHOD::POST) |
||
62 | * @return \Apache_Solr_Response Solr response |
||
63 | * @throws \RuntimeException if Solr returns a HTTP status code other than 200 |
||
64 | */ |
||
65 | public function search($query, $offset = 0, $limit = 10, $params = [], $method = self::METHOD_GET) |
||
80 | |||
81 | /** |
||
82 | * Returns whether a search has been executed or not. |
||
83 | * |
||
84 | * @return bool TRUE if a search has been executed, FALSE otherwise |
||
85 | */ |
||
86 | public function hasSearched() |
||
90 | |||
91 | /** |
||
92 | * Gets the most recent response (if any) |
||
93 | * |
||
94 | * @return \Apache_Solr_Response Most recent response, or NULL if a search has not been executed yet. |
||
95 | */ |
||
96 | public function getResponse() |
||
100 | |||
101 | /** |
||
102 | * This method maps the failed solr requests to a meaningful exception. |
||
103 | * |
||
104 | * @param \Apache_Solr_Response $response |
||
105 | * @throws SolrCommunicationException |
||
106 | * @return \Apache_Solr_Response |
||
107 | */ |
||
108 | protected function handleErrorResponses(\Apache_Solr_Response $response) |
||
130 | |||
131 | } |