Browse files

[bug 745473] Fix typo

pyes switched from indices to indexes (or vice versa--I can't remember).
Point being that we were using the wrong one the result of which being
that it used the default index created with the ES object which calculates
the index name differently. Ugh.

This fixes that by changing the argument from indices to indexes. Now it
uses the one calculated in get_documents and all is well.

This also adds a test for get_documents.

And while doing that, I tidied up the import statements.
  • Loading branch information...
1 parent 5ea3bf1 commit 6f4a0d35d9c8d57172387f0c2bf9c8d869c4526d @willkg committed Apr 14, 2012
Showing with 16 additions and 7 deletions.
  1. +1 −1 apps/search/
  2. +15 −6 apps/search/tests/
2 apps/search/
@@ -166,7 +166,7 @@ def get_documents(cls, ids):
doctype = cls._meta.db_table
index = READ_INDEX
- ret =, ids), indices=[index],
+ ret =, ids), indexes=[index],
return ret['hits']['hits']
21 apps/search/tests/
@@ -2,16 +2,16 @@
import datetime
from import eq_
+import mock
-from sumo.tests import LocalizingClient, ElasticTestCase
-from sumo.urlresolvers import reverse
-from search.models import generate_tasks
+from forums.tests import thread, post
from questions.tests import question, answer, answervote
from questions.models import Question
+from search.models import generate_tasks
+from search.es_utils import get_documents
+from sumo.tests import LocalizingClient, ElasticTestCase
+from sumo.urlresolvers import reverse
from wiki.tests import document, revision
-from forums.tests import thread, post
-import mock
class ElasticSearchTasksTests(ElasticTestCase):
@@ -317,3 +317,12 @@ def test_forums_thread_created(self):
content = json.loads(response.content)
eq_(content['total'], 0)
+class ElasticSearchUtilsTests(ElasticTestCase):
+ def test_get_documents(self):
+ q = question(save=True)
+ self.refresh()
+ docs = get_documents(Question, [])
+ docs = [int(mem[u'_id']) for mem in docs]
+ eq_(docs, [])

0 comments on commit 6f4a0d3

Please sign in to comment.