MCPcopy Create free account
hub / github.com/django-haystack/django-haystack / search

Method search

haystack/backends/solr_backend.py:155–175  ·  view source on GitHub ↗
(self, query_string, **kwargs)

Source from the content-addressed store, hash-verified

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,

Callers 1

runMethod · 0.45

Calls 4

build_search_kwargsMethod · 0.95
_process_resultsMethod · 0.95
EmptyResultsClass · 0.90
getMethod · 0.80

Tested by

no test coverage detected