Author: humbedooh
Date: Sun Mar 27 18:01:58 2016
New Revision: 1736796
URL: http://svn.apache.org/viewvc?rev=1736796&view=rev
Log:
try to look for both the doc id and the doc hash key when finding a voter
Modified:
steve/trunk/pysteve/lib/backends/es.py
Modified: steve/trunk/pysteve/lib/backends/es.py
URL:
http://svn.apache.org/viewvc/steve/trunk/pysteve/lib/backends/es.py?rev=1736796&r1=1736795&r2=1736796&view=diff
==============================================================================
--- steve/trunk/pysteve/lib/backends/es.py (original)
+++ steve/trunk/pysteve/lib/backends/es.py Sun Mar 27 18:01:58 2016
@@ -208,6 +208,13 @@ class ElasticSearchBackend:
def voter_get_uid(self, electionID, votekey):
"Get the UID/email for a voter given the vote key hash"
+
+ # First, try the raw hash as an ID
+ res = self.es.get(index="steve", doc_type="voters", id=votekey)
+ if res:
+ return res['_source']['uid']
+
+ # Now, look for it as hash inside the doc
try:
res = self.es.search(index="steve", doc_type="voters", q =
"election:%s" % electionID, size = 9999)
results = len(res['hits']['hits'])