(self, query_string, **kwargs)
| 153 | |
| 154 | @log_query |
| 155 | def search(self, query_string, **kwargs): |
| 156 | if len(query_string) == 0: |
| 157 | return {"results": [], "hits": 0} |
| 158 | |
| 159 | search_kwargs = self.build_search_kwargs(query_string, **kwargs) |
| 160 | |
| 161 | try: |
| 162 | raw_results = self.conn.search(query_string, **search_kwargs) |
| 163 | except (IOError, SolrError): |
| 164 | if not self.silently_fail: |
| 165 | raise |
| 166 | |
| 167 | self.log.exception("Failed to query Solr using '%s'", query_string) |
| 168 | raw_results = EmptyResults() |
| 169 | |
| 170 | return self._process_results( |
| 171 | raw_results, |
| 172 | highlight=kwargs.get("highlight"), |
| 173 | result_class=kwargs.get("result_class", SearchResult), |
| 174 | distance_point=kwargs.get("distance_point"), |
| 175 | ) |
| 176 | |
| 177 | def build_search_kwargs( |
| 178 | self, |
no test coverage detected