Пробный индекс неактуальных пунктов
This commit is contained in:
parent
ce934b9f1b
commit
9f67e139d6
@ -48,7 +48,7 @@ class SphinxSearch:
|
|||||||
self.client_sugg.SetSortMode(sphinxapi.SPH_SORT_EXTENDED, "krank DESC")
|
self.client_sugg.SetSortMode(sphinxapi.SPH_SORT_EXTENDED, "krank DESC")
|
||||||
else:
|
else:
|
||||||
self.client_show.SetRankingMode(sphinxapi.SPH_RANK_BM25)
|
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):
|
def __get_suggest(self, word, rating_limit, count):
|
||||||
word_len = str(len(word) / 2)
|
word_len = str(len(word) / 2)
|
||||||
@ -132,7 +132,7 @@ class SphinxSearch:
|
|||||||
|
|
||||||
# формируем строки для поиска в Сфинксе
|
# формируем строки для поиска в Сфинксе
|
||||||
for x in range(word_count, max(0, word_count - 3), -1):
|
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)
|
sphinx_conf.index_addjobj)
|
||||||
|
|
||||||
self.__configure(sphinx_conf.index_addjobj)
|
self.__configure(sphinx_conf.index_addjobj)
|
||||||
@ -156,6 +156,6 @@ class SphinxSearch:
|
|||||||
results.append(
|
results.append(
|
||||||
dict(aoid=ma['attrs']['aoid'], text=unicode(ma['attrs']['fullname']), ratio=ma['weight'], cort=i))
|
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
|
return results
|
||||||
|
@ -9,6 +9,6 @@
|
|||||||
PATH.fullname || ', ' || child.shortname || ' ' || child.formalname AS fullname
|
PATH.fullname || ', ' || child.shortname || ' ' || child.formalname AS fullname
|
||||||
FROM "ADDROBJ" AS child
|
FROM "ADDROBJ" AS child
|
||||||
, PATH
|
, 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)
|
SELECT * FROM PATH WHERE AOLEVEL NOT IN (1,3)
|
Loading…
x
Reference in New Issue
Block a user