diff --git a/aore/phias.py b/aore/phias.py index 9dca53b..0e0d80c 100644 --- a/aore/phias.py +++ b/aore/phias.py @@ -4,7 +4,7 @@ import logging from bottle import Bottle, response -from aore.fias.fiasfactory import FiasFactory +from aore.search.fiasfactory import FiasFactory logging.basicConfig(format='%(asctime)s %(message)s', level=logging.INFO) app = Bottle() diff --git a/aore/fias/__init__.py b/aore/search/__init__.py similarity index 100% rename from aore/fias/__init__.py rename to aore/search/__init__.py diff --git a/aore/fias/fiasfactory.py b/aore/search/fiasfactory.py similarity index 98% rename from aore/fias/fiasfactory.py rename to aore/search/fiasfactory.py index 0563c8f..175620e 100644 --- a/aore/fias/fiasfactory.py +++ b/aore/search/fiasfactory.py @@ -8,7 +8,7 @@ from bottle import template from aore.config import db_conf from aore.dbutils.dbimpl import DBImpl -from aore.fias.search import SphinxSearch +from aore.search.search import SphinxSearch class FiasFactory: diff --git a/aore/fias/search.py b/aore/search/search.py similarity index 92% rename from aore/fias/search.py rename to aore/search/search.py index 0da4746..6083868 100644 --- a/aore/fias/search.py +++ b/aore/search/search.py @@ -7,8 +7,8 @@ import sphinxapi from aore.config import basic from aore.config import sphinx_conf -from aore.fias.wordentry import WordEntry -from aore.fias.wordvariation import VariationType +from aore.search.wordentry import WordEntry +from aore.search.wordvariation import VariationType from aore.miscutils.trigram import trigram @@ -130,8 +130,10 @@ class SphinxSearch: 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) + del second_q self.client_show.AddQuery(first_q, sphinx_conf.index_addjobj) + del first_q start_t = time.time() rs = self.client_show.RunQueries() @@ -144,13 +146,15 @@ class SphinxSearch: parsed_ids = [] for i in range(0, len(rs)): - for ma in rs[i]['matches']: + for match in rs[i]['matches']: if len(results) >= self.max_result: break - if not ma['attrs']['aoid'] in parsed_ids: - parsed_ids.append(ma['attrs']['aoid']) + if not match['attrs']['aoid'] in parsed_ids: + parsed_ids.append(match['attrs']['aoid']) results.append( - dict(aoid=ma['attrs']['aoid'], text=unicode(ma['attrs']['fullname']), ratio=ma['attrs']['krank'], + dict(aoid=match['attrs']['aoid'], + text=unicode(match['attrs']['fullname']), + ratio=match['attrs']['krank'], cort=i)) return results diff --git a/aore/fias/wordentry.py b/aore/search/wordentry.py similarity index 99% rename from aore/fias/wordentry.py rename to aore/search/wordentry.py index 53d067c..b4001f8 100644 --- a/aore/fias/wordentry.py +++ b/aore/search/wordentry.py @@ -2,7 +2,7 @@ import re from aore.config import sphinx_conf -from aore.fias.wordvariation import WordVariation, VariationType +from aore.search.wordvariation import WordVariation, VariationType class WordEntry: diff --git a/aore/fias/wordvariation.py b/aore/search/wordvariation.py similarity index 100% rename from aore/fias/wordvariation.py rename to aore/search/wordvariation.py diff --git a/aore/updater/soapreceiver.py b/aore/updater/soapreceiver.py index e43c9ef..4638986 100644 --- a/aore/updater/soapreceiver.py +++ b/aore/updater/soapreceiver.py @@ -5,9 +5,9 @@ from pysimplesoap.client import SoapClient class SoapReceiver: def __init__(self): self.client = SoapClient( - location="http://fias.nalog.ru/WebServices/Public/DownloadService.asmx", - action='http://fias.nalog.ru/WebServices/Public/DownloadService.asmx/', - namespace="http://fias.nalog.ru/WebServices/Public/DownloadService.asmx", + location="http://search.nalog.ru/WebServices/Public/DownloadService.asmx", + action='http://search.nalog.ru/WebServices/Public/DownloadService.asmx/', + namespace="http://search.nalog.ru/WebServices/Public/DownloadService.asmx", soap_ns='soap', trace=False, ns=False) # return (intver, strver, url) diff --git a/setup.py b/setup.py deleted file mode 100644 index 408ed83..0000000 --- a/setup.py +++ /dev/null @@ -1,21 +0,0 @@ -from setuptools import setup - -setup( - name='py-phias', - version='0.0.1', - packages=['aore', 'aore.fias', 'aore.config', 'aore.dbutils', 'aore.updater', 'aore.miscutils'], - url='https://github.com/jar3b/py-phias', - license='BSD', - author='hellotan', - author_email='hellotan@live.ru', - description='Python application that can operate with FIAS (Russian Address Object DB)', - install_requires= - ['lxml', - 'psycopg2>=2.6.0', - 'bottle>=0.12.0', - 'pysimplesoap', - 'python-Levenshtein', - 'enum34', - 'rarfile', - 'requests'] -)