Commits

Matt Chaput  committed 28dbb7e

Added a unit test for using a numeric field as the unique key for update_document.
I'm pretty sure this already exists somewhere else, but I couldn't find it.

  • Participants
  • Parent commits fb14e84

Comments (0)

Files changed (1)

File tests/test_indexing.py

             assert_equal(results, "0 1 2 3 4 5 6 7 8 9")
 
 
+def test_update_numeric():
+    schema = fields.Schema(num=fields.NUMERIC(unique=True, stored=True),
+                           text=fields.ID(stored=True))
+    with TempIndex(schema, "updatenum") as ix:
+        nums = list(range(10)) * 3
+        random.shuffle(nums)
+        for num in nums:
+            with ix.writer() as w:
+                w.update_document(num=num, text=text_type(num))
+
+        with ix.searcher() as s:
+            results = [d["text"] for _, d in s.iter_docs()]
+            results = " ".join(sorted(results))
+            assert_equal(results, "0 1 2 3 4 5 6 7 8 9")
+
+
 def test_reindex():
     SAMPLE_DOCS = [
         {'id': u('test1'),