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

Method run_mlt

haystack/backends/solr_backend.py:951–972  ·  view source on GitHub ↗

Builds and executes the query. Returns a list of search results.

(self, **kwargs)

Source from the content-addressed store, hash-verified

949 self._spelling_suggestion = results.get("spelling_suggestion", None)
950
951 def run_mlt(self, **kwargs):
952 """Builds and executes the query. Returns a list of search results."""
953 if self._more_like_this is False or self._mlt_instance is None:
954 raise MoreLikeThisError(
955 "No instance was provided to determine 'More Like This' results."
956 )
957
958 additional_query_string = self.build_query()
959 search_kwargs = {
960 "start_offset": self.start_offset,
961 "result_class": self.result_class,
962 "models": self.models,
963 }
964
965 if self.end_offset is not None:
966 search_kwargs["end_offset"] = self.end_offset - self.start_offset
967
968 results = self.backend.more_like_this(
969 self._mlt_instance, additional_query_string, **search_kwargs
970 )
971 self._results = results.get("results", [])
972 self._hit_count = results.get("hits", 0)
973
974
975class SolrEngine(BaseEngine):

Callers

nothing calls this directly

Calls 4

MoreLikeThisErrorClass · 0.90
getMethod · 0.80
build_queryMethod · 0.45
more_like_thisMethod · 0.45

Tested by

no test coverage detected