From 9f67e139d6e256c41f29402d3599ee0998dd29d1 Mon Sep 17 00:00:00 2001 From: Jack Stdin Date: Thu, 18 Feb 2016 15:07:40 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9F=D1=80=D0=BE=D0=B1=D0=BD=D1=8B=D0=B9=20?= =?UTF-8?q?=D0=B8=D0=BD=D0=B4=D0=B5=D0=BA=D1=81=20=D0=BD=D0=B5=D0=B0=D0=BA?= =?UTF-8?q?=D1=82=D1=83=D0=B0=D0=BB=D1=8C=D0=BD=D1=8B=D1=85=20=D0=BF=D1=83?= =?UTF-8?q?=D0=BD=D0=BA=D1=82=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- aore/fias/search.py | 6 +++--- aore/templates/postgre/sphinx_query.sql | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/aore/fias/search.py b/aore/fias/search.py index b771b39..9660047 100644 --- a/aore/fias/search.py +++ b/aore/fias/search.py @@ -48,7 +48,7 @@ class SphinxSearch: self.client_sugg.SetSortMode(sphinxapi.SPH_SORT_EXTENDED, "krank DESC") else: self.client_show.SetRankingMode(sphinxapi.SPH_RANK_BM25) - self.client_show.SetSortMode(sphinxapi.SPH_SORT_RELEVANCE) + #self.client_show.SetSortMode(sphinxapi.SPH_SORT_) def __get_suggest(self, word, rating_limit, count): word_len = str(len(word) / 2) @@ -132,7 +132,7 @@ class SphinxSearch: # формируем строки для поиска в Сфинксе for x in range(word_count, max(0, word_count - 3), -1): - self.client_show.AddQuery("\"{}\"/{}".format(" ".join(x.get_variations() for x in word_entries), x), + self.client_show.AddQuery("\"{}\"/{} \"ул \"/0".format(" ".join(x.get_variations() for x in word_entries), x), sphinx_conf.index_addjobj) self.__configure(sphinx_conf.index_addjobj) @@ -156,6 +156,6 @@ class SphinxSearch: results.append( dict(aoid=ma['attrs']['aoid'], text=unicode(ma['attrs']['fullname']), ratio=ma['weight'], cort=i)) - results.sort(key=lambda x: Levenshtein.ratio(text, x['text']), reverse=True) + # results.sort(key=lambda x: Levenshtein.ratio(text, x['text']), reverse=True) return results diff --git a/aore/templates/postgre/sphinx_query.sql b/aore/templates/postgre/sphinx_query.sql index 7d961af..ea4e93d 100644 --- a/aore/templates/postgre/sphinx_query.sql +++ b/aore/templates/postgre/sphinx_query.sql @@ -9,6 +9,6 @@ PATH.fullname || ', ' || child.shortname || ' ' || child.formalname AS fullname FROM "ADDROBJ" AS child , PATH - WHERE child.parentguid = PATH.aoguid AND actstatus = TRUE AND livestatus = TRUE AND nextid IS NULL + WHERE child.parentguid = PATH.aoguid ) SELECT * FROM PATH WHERE AOLEVEL NOT IN (1,3) \ No newline at end of file