diff --git a/aore/fias/search.py b/aore/fias/search.py index 1add937..0da4746 100644 --- a/aore/fias/search.py +++ b/aore/fias/search.py @@ -123,30 +123,16 @@ class SphinxSearch: good_vars_word_count = len(set([v.parent for v in good_vars])) freq_vars_word_count = len(set([v.parent for v in freq_vars])) + self.__configure(sphinx_conf.index_addjobj, word_count) # формируем строки для поиска в Сфинксе for i in range(good_vars_word_count, max(0, good_vars_word_count - 3), -1): first_q = "@fullname \"{}\"/{}".format(" ".join(good_var.text for good_var in good_vars), i) if self.search_freq_words and freq_vars_word_count: second_q = " @sname {}".format(" ".join(freq_var.text for freq_var in freq_vars)) self.client_show.AddQuery(first_q + second_q, sphinx_conf.index_addjobj) + self.client_show.AddQuery(first_q, sphinx_conf.index_addjobj) - # if self.search_freq_words: - # for j in range(freq_vars_word_count, -1, -1): - # if j == 0: - # second_q = "" - # else: - # second_q = " @sname {}".format(" | ".join(freq_var.text for freq_var in freq_vars), j) - # second_q = second_q.replace("*", "") - # - # print first_q + second_q - # self.client_show.AddQuery(first_q + second_q, sphinx_conf.index_addjobj) - # else: - # print first_q - # self.client_show.AddQuery(first_q, sphinx_conf.index_addjobj) - - self.__configure(sphinx_conf.index_addjobj, word_count) - start_t = time.time() rs = self.client_show.RunQueries() elapsed_t = time.time() - start_t @@ -164,9 +150,7 @@ class SphinxSearch: if not ma['attrs']['aoid'] in parsed_ids: parsed_ids.append(ma['attrs']['aoid']) results.append( - dict(aoid=ma['attrs']['aoid'], text=unicode(ma['attrs']['fullname']), ratio=ma['weight'], + dict(aoid=ma['attrs']['aoid'], text=unicode(ma['attrs']['fullname']), ratio=ma['attrs']['krank'], cort=i)) - # results.sort(key=lambda x: Levenshtein.ratio(text, x['text']), reverse=False) - return results diff --git a/aore/miscutils/sphinx.py b/aore/miscutils/sphinx.py index 751de25..04a66e7 100644 --- a/aore/miscutils/sphinx.py +++ b/aore/miscutils/sphinx.py @@ -143,7 +143,8 @@ class SphinxHelper: out_filename = os.path.abspath(config_fname) logging.info("Creating main config %s...", out_filename) - conf_data = template('aore/templates/sphinx/sphinx.conf', sphinx_listen=sphinx_conf.listen, + conf_data = template('aore/templates/sphinx/sphinx.conf', + sphinx_listen=sphinx_conf.listen.replace("unix://", ''), sphinx_var_path=sphinx_conf.var_dir) f = open(out_filename, "w") diff --git a/aore/templates/sphinx/idx_addrobj.conf b/aore/templates/sphinx/idx_addrobj.conf index 04ba7f0..5f60136 100644 --- a/aore/templates/sphinx/idx_addrobj.conf +++ b/aore/templates/sphinx/idx_addrobj.conf @@ -24,6 +24,7 @@ index {{ index_name }} # strip html by default html_strip = 1 + docinfo = extern ignore_chars = @, - charset_table = 0..9, A..Z->a..z, _, a..z, \ diff --git a/aore/templates/sphinx/idx_suggest.conf b/aore/templates/sphinx/idx_suggest.conf index 1249518..9b37f3e 100644 --- a/aore/templates/sphinx/idx_suggest.conf +++ b/aore/templates/sphinx/idx_suggest.conf @@ -20,5 +20,4 @@ index {{index_name}} source = {{index_name}} path = {{sphinx_var_path}}/data/{{index_name}} docinfo = extern - charset_type = utf-8 } \ No newline at end of file diff --git a/aore/templates/sphinx/sphinx.conf b/aore/templates/sphinx/sphinx.conf index 16c7758..5a5b0c2 100644 --- a/aore/templates/sphinx/sphinx.conf +++ b/aore/templates/sphinx/sphinx.conf @@ -43,11 +43,6 @@ searchd # mandatory pid_file = {{sphinx_var_path}}/run/searchd.pid - # max amount of matches the daemon ever keeps in RAM, per-index - # WARNING, THERE'S ALSO PER-QUERY LIMIT, SEE SetLimits() API CALL - # default is 1000 (just like Google) - max_matches = 1000 - # seamless rotate, prevents rotate stalls if precaching huge datasets # optional, default is 1 seamless_rotate = 1