Executes the More Like This. Returns a list of search results similar to the provided document (and optionally query).
(self, **kwargs)
| 597 | self._spelling_suggestion = results.get("spelling_suggestion", None) |
| 598 | |
| 599 | def run_mlt(self, **kwargs): |
| 600 | """ |
| 601 | Executes the More Like This. Returns a list of search results similar |
| 602 | to the provided document (and optionally query). |
| 603 | """ |
| 604 | if self._more_like_this is False or self._mlt_instance is None: |
| 605 | raise MoreLikeThisError( |
| 606 | "No instance was provided to determine 'More Like This' results." |
| 607 | ) |
| 608 | |
| 609 | search_kwargs = {"result_class": self.result_class} |
| 610 | |
| 611 | if self.models: |
| 612 | search_kwargs["models"] = self.models |
| 613 | |
| 614 | if kwargs: |
| 615 | search_kwargs.update(kwargs) |
| 616 | |
| 617 | additional_query_string = self.build_query() |
| 618 | results = self.backend.more_like_this( |
| 619 | self._mlt_instance, additional_query_string, **search_kwargs |
| 620 | ) |
| 621 | self._results = results.get("results", []) |
| 622 | self._hit_count = results.get("hits", 0) |
| 623 | |
| 624 | def run_raw(self, **kwargs): |
| 625 | """Executes a raw query. Returns a list of search results.""" |
no test coverage detected