Add logging option

This commit is contained in:
Jack Stdin 2016-02-15 12:16:53 +03:00
parent 56f44e324a
commit 14118e4b0d
4 changed files with 8 additions and 4 deletions

View File

@ -1,5 +1,8 @@
# -*- coding: utf-8 -*-
class basic:
logging = False
class sphinx_conf:
host_name = "localhost"

View File

@ -16,3 +16,5 @@ db_conf.password = "intercon"
unrar_config.path = "C:\\Program Files (x86)\\WinRAR\\unrar.exe"
folders.temp = "E:\\!TEMP"
basic.logging = True

View File

@ -116,14 +116,11 @@ class SphinxSearch:
word_entries = self.__get_word_entries(words, strong)
word_count = len(word_entries)
for x in range(word_count, max(0, word_count - 3), -1):
logging.info("\"{}\"/{}".format(" ".join(x.get_variations() for x in word_entries), x))
self.client_show.AddQuery("\"{}\"/{}".format(" ".join(x.get_variations() for x in word_entries), x),
sphinx_conf.index_addjobj)
self.__configure(sphinx_conf.index_addjobj)
logging.info("QUERY ")
rs = self.client_show.RunQueries()
logging.info("OK")
results = []
parsed_ids = []

View File

@ -2,6 +2,7 @@
import re
from aore.config import sphinx_conf
from aore.config import basic
class WordEntry:
@ -106,7 +107,8 @@ class WordEntry:
out_mask_list.append('x')
else:
out_mask_list.append(str(result[i][0]))
if basic.logging:
print str(self.word) + ''.join(out_mask_list)
return ''.join(out_mask_list)
def get_type(self):