Пробный индекс неактуальных пунктов

This commit is contained in:
Jack Stdin 2016-02-18 15:07:40 +03:00
parent ce934b9f1b
commit 9f67e139d6
2 changed files with 4 additions and 4 deletions

View File

@ -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

View File

@ -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)