diff --git a/aore/search/fiasfactory.py b/aore/search/fiasfactory.py index 0f63c89..b8cdae8 100644 --- a/aore/search/fiasfactory.py +++ b/aore/search/fiasfactory.py @@ -21,7 +21,8 @@ class FiasFactory: self.normalize_templ = template('aore/templates/postgre/normalize_query.sql', aoid="//aoid") # Проверка, что строка является действительым UUID v4 - def __check_uuid(self, guid): + @staticmethod + def __check_uuid(guid): try: UUID(guid) except ValueError: diff --git a/aore/search/search.py b/aore/search/search.py index fe596c7..f54535b 100644 --- a/aore/search/search.py +++ b/aore/search/search.py @@ -30,15 +30,19 @@ class SphinxSearch: sphinx_host = sphinx_conf.listen sphinx_port = None + + # Получаем строку подключения для Sphinx if ":" in sphinx_conf.listen and "unix:/" not in sphinx_conf.listen: sphinx_host, sphinx_port = sphinx_conf.listen.split(":") sphinx_port = int(sphinx_port) + # Настраиваем подключение для подсказок self.client_sugg = sphinxapi.SphinxClient() self.client_sugg.SetServer(sphinx_host, sphinx_port) self.client_sugg.SetLimits(0, self.max_result) self.client_sugg.SetConnectTimeout(3.0) + # Настраиваем подключение для поиска адреса self.client_show = sphinxapi.SphinxClient() self.client_show.SetServer(sphinx_host, sphinx_port) self.client_show.SetLimits(0, self.max_result) @@ -141,12 +145,12 @@ class SphinxSearch: rs = self.client_show.RunQueries() elapsed_t = time.time() - start_t - if basic.logging: - logging.info("Sphinx time for {} = {}".format(text, elapsed_t)) - if rs is None: raise FiasException("Cannot find sentence.") + if basic.logging: + logging.info("Sphinx time for {} = {}".format(text, elapsed_t)) + results = [] parsed_ids = []