Изменена генерация индексов, начало обработки "частых" слов.

This commit is contained in:
Jack Stdin
2016-02-03 17:30:47 +03:00
parent 29a26132e1
commit 897ea66046
7 changed files with 42 additions and 33 deletions

View File

@@ -11,20 +11,20 @@ app = Bottle()
fias_factory = FiasFactory()
@app.route('/expand/<aoid:re:[\w]{8}(-[\w]{4}){3}-[\w]{12}>')
@app.route(r'/expand/<aoid:re:[\w]{8}(-[\w]{4}){3}-[\w]{12}>')
def expand(aoid):
response.content_type = 'application/json'
return json.dumps(fias_factory.expand(aoid))
@app.route('/normalize/<aoid:re:[\w]{8}(-[\w]{4}){3}-[\w]{12}>')
@app.route(r'/normalize/<aoid:re:[\w]{8}(-[\w]{4}){3}-[\w]{12}>')
def normalize(aoid):
response.content_type = 'application/json'
return json.dumps(fias_factory.normalize(aoid))
@app.route('/find/<text>')
@app.route('/find/<text>/<strong>')
@app.route(r'/find/<text>')
@app.route(r'/find/<text>/<strong>')
def find(text, strong=False):
strong = (strong == "strong")
response.content_type = 'application/json'
@@ -33,6 +33,6 @@ def find(text, strong=False):
@app.error(404)
def error404():
def error404(error):
response.content_type = 'application/json'
return json.dumps(dict(error="Page not found"))