Skip to content

Commit

Permalink
Merge-time changes
Browse files Browse the repository at this point in the history
  • Loading branch information
RitwikGupta committed Apr 4, 2016
1 parent 98f7a38 commit a374fbc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
7 changes: 4 additions & 3 deletions pqr.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[uwsgi]
http = 0.0.0.0:8080
wsgi-file = uwsgi.py
socket = 0.0.0.0:8080
wsgi-file = uwsgi.py
callable = pqr
processes = 4
processes = 1
daemonize = log.log
11 changes: 7 additions & 4 deletions pqr/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -599,10 +599,13 @@ def similar(x, f, m0, query):
return sum(score_list)
else:
# if x in query:
if query in x:
score = 10 + ratio(x.encode('utf8', 'ignore'), query.encode('utf8', 'ignore')) + m0 / formula2mass(f)
else:
score = ratio(x.encode('utf8', 'ignore'), query.encode('utf8', 'ignore')) + m0 / formula2mass(f)
try:
if query in x:
score = 10 + ratio(x.encode('utf8', 'ignore'), query.encode('utf8', 'ignore')) + m0 / formula2mass(f)
else:
score = ratio(x.encode('utf8', 'ignore'), query.encode('utf8', 'ignore')) + m0 / formula2mass(f)
except ZeroDivisionError:
score = 100
return score

def formula2mass(f):
Expand Down

0 comments on commit a374fbc

Please sign in to comment.