couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From robertkowal...@apache.org
Subject [43/50] [abbrv] couchdb-mango git commit: Support Text Index Creation
Date Tue, 03 Feb 2015 15:13:50 GMT
http://git-wip-us.apache.org/repos/asf/couchdb-mango/blob/aa4edf42/test/09-text-sort-test.py
----------------------------------------------------------------------
diff --git a/test/09-text-sort-test.py b/test/09-text-sort-test.py
new file mode 100644
index 0000000..d2bd454
--- /dev/null
+++ b/test/09-text-sort-test.py
@@ -0,0 +1,89 @@
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+import mango
+import user_docs
+
+class SortTests(mango.UserDocsTextTests):
+
+    def test_number_sort(self):
+        q = {"age": {"$gt": 0}}
+        docs = self.db.find(q, sort=["age:number"])
+        assert len(docs) == 15
+        assert docs[0]["age"] == 22
+
+    def test_string_sort(self):
+        q = {"email": {"$gt": None}}
+        docs = self.db.find(q, sort=["email:string"])
+        assert len(docs) == 15
+        assert docs[0]["email"] == "abbottwatson@talkola.com"
+
+    def test_notype_sort(self):
+        q = {"email": {"$gt": None}}
+        try:
+            self.db.find(q, sort=["email"])
+        except Exception, e:
+            assert e.response.status_code == 400
+        else:
+            raise AssertionError("Should have thrown error for sort")
+
+    def test_array_sort(self):
+        q = {"favorites": {"$exists": True}}
+        docs = self.db.find(q, sort=["favorites.[]:string"])
+        assert len(docs) == 15
+        assert docs[0]["user_id"] == 8
+
+    def test_multi_sort(self):
+        q = {"name": {"$exists": True}}
+        docs = self.db.find(q, sort=["name.last:string", "age:number"])
+        assert len(docs) == 15
+        assert docs[0]["name"] == {"last":"Ewing","first":"Shelly"}
+        assert docs[1]["age"] == 22
+
+    def test_guess_type_sort(self):
+        q = {"$or": [{"age":{"$gt": 0}}, {"email": {"$gt": None}}]}
+        docs = self.db.find(q, sort=["age"])
+        assert len(docs) == 15
+        assert docs[0]["age"] == 22
+
+    def test_guess_dup_type_sort(self):
+        q = {"$and": [{"age":{"$gt": 0}}, {"email": {"$gt": None}},
+            {"age":{"$lte": 100}}]}
+        docs = self.db.find(q, sort=["age"])
+        assert len(docs) == 15
+        assert docs[0]["age"] == 22
+
+    def test_ambiguous_type_sort(self):
+        q = {"$or": [{"age":{"$gt": 0}}, {"email": {"$gt": None}},
+            {"age": "34"}]}
+        try:
+            self.db.find(q, sort=["age"])
+        except Exception, e:
+            assert e.response.status_code == 400
+        else:
+            raise AssertionError("Should have thrown error for sort")
+
+    def test_guess_multi_sort(self):
+        q = {"$or": [{"age":{"$gt": 0}}, {"email": {"$gt": None}},
+            {"name.last": "Harvey"}]}
+        docs = self.db.find(q, sort=["name.last", "age"])
+        assert len(docs) == 15
+        assert docs[0]["name"] == {"last":"Ewing","first":"Shelly"}
+        assert docs[1]["age"] == 22
+
+    def test_guess_mix_sort(self):
+        q = {"$or": [{"age":{"$gt": 0}}, {"email": {"$gt": None}},
+            {"name.last": "Harvey"}]}
+        docs = self.db.find(q, sort=["name.last:string", "age"])
+        assert len(docs) == 15
+        assert docs[0]["name"] == {"last":"Ewing","first":"Shelly"}
+        assert docs[1]["age"] == 22

http://git-wip-us.apache.org/repos/asf/couchdb-mango/blob/aa4edf42/test/friend_docs.py
----------------------------------------------------------------------
diff --git a/test/friend_docs.py b/test/friend_docs.py
new file mode 100644
index 0000000..8bba58d
--- /dev/null
+++ b/test/friend_docs.py
@@ -0,0 +1,568 @@
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+"""
+Generated with http://www.json-generator.com/
+
+With this pattern:
+
+[
+  '{{repeat(15)}}',
+  {
+    _id: '{{index()}}',
+    name: {
+      first: '{{firstName()}}',
+      last: '{{surname()}}'
+    },
+    friends: [
+      '{{repeat(3)}}',
+      {
+        id: '{{index()}}',
+        name: {
+          first: '{{firstName()}}',
+          last: '{{surname()}}'
+        },
+        type: '{{random("personal", "work")}}'
+      }
+    ]
+  }
+]
+"""
+
+import copy
+
+
+def setup(db, index_type="view"):
+    db.recreate()
+    db.save_docs(copy.deepcopy(DOCS))
+    if index_type == "view":
+        add_view_indexes(db)
+    elif index_type == "text":
+        add_text_indexes(db)
+
+
+def add_text_indexes(db):
+    db.create_text_index()
+
+
+DOCS =  [
+    {
+        "_id": "54a43171d37ae5e81bff5ae0",
+        "user_id": 0,
+        "name": {
+            "first": "Ochoa",
+            "last": "Fox"
+        },
+        "friends": [
+            {
+                "id": 0,
+                "name": {
+                    "first": "Sherman",
+                    "last": "Davidson"
+                },
+                "type": "personal"
+            },
+            {
+                "id": 1,
+                "name": {
+                    "first": "Vargas",
+                    "last": "Mendez"
+                },
+                "type": "personal"
+            },
+            {
+                "id": 2,
+                "name": {
+                    "first": "Sheppard",
+                    "last": "Cotton"
+                },
+                "type": "work"
+            }
+        ]
+    },
+    {
+        "_id": "54a43171958485dc32917c50",
+        "user_id": 1,
+        "name": {
+            "first": "Sheppard",
+            "last": "Cotton"
+        },
+        "friends": [
+            {
+                "id": 0,
+                "name": {
+                    "first": "Ochoa",
+                    "last": "Fox"
+                },
+                "type": "work"
+            },
+            {
+                "id": 1,
+                "name": {
+                    "first": "Vargas",
+                    "last": "Mendez"
+                },
+                "type": "personal"
+            },
+            {
+                "id": 2,
+                "name": {
+                    "first": "Kendra",
+                    "last": "Burns"
+                },
+                "type": "work"
+            }
+        ]
+    },
+    {
+        "_id": "54a431711cf025ba74bea899",
+        "user_id": 2,
+        "name": {
+            "first": "Hunter",
+            "last": "Wells"
+        },
+        "friends": [
+            {
+                "id": 0,
+                "name": {
+                    "first": "Estes",
+                    "last": "Fischer"
+                },
+                "type": "work"
+            },
+            {
+                "id": 1,
+                "name": {
+                    "first": "Farrell",
+                    "last": "Maddox"
+                },
+                "type": "personal"
+            },
+            {
+                "id": 2,
+                "name": {
+                    "first": "Kendra",
+                    "last": "Burns"
+                },
+                "type": "work"
+            }
+        ]
+    },
+    {
+        "_id": "54a4317151a70a9881ac28a4",
+        "user_id": 3,
+        "name": {
+            "first": "Millicent",
+            "last": "Guy"
+        },
+        "friends": [
+            {
+                "id": 0,
+                "name": {
+                    "first": "Luella",
+                    "last": "Mendoza"
+                },
+                "type": "work"
+            },
+            {
+                "id": 1,
+                "name": {
+                    "first": "Melanie",
+                    "last": "Foster"
+                },
+                "type": "personal"
+            },
+            {
+                "id": 2,
+                "name": {
+                    "first": "Hopkins",
+                    "last": "Scott"
+                },
+                "type": "work"
+            }
+        ]
+    },
+    {
+        "_id": "54a43171d946b78703a0e076",
+        "user_id": 4,
+        "name": {
+            "first": "Elisabeth",
+            "last": "Brady"
+        },
+        "friends": [
+            {
+                "id": 0,
+                "name": {
+                    "first": "Sofia",
+                    "last": "Workman"
+                },
+                "type": "work"
+            },
+            {
+                "id": 1,
+                "name": {
+                    "first": "Alisha",
+                    "last": "Reilly"
+                },
+                "type": "work"
+            },
+            {
+                "id": 2,
+                "name": {
+                    "first": "Ochoa",
+                    "last": "Burch"
+                },
+                "type": "personal"
+            }
+        ]
+    },
+    {
+        "_id": "54a4317118abd7f1992464ee",
+        "user_id": 5,
+        "name": {
+            "first": "Pollard",
+            "last": "French"
+        },
+        "friends": [
+            {
+                "id": 0,
+                "name": {
+                    "first": "Hollie",
+                    "last": "Juarez"
+                },
+                "type": "personal"
+            },
+            {
+                "id": 1,
+                "name": {
+                    "first": "Nelda",
+                    "last": "Newton"
+                },
+                "type": "personal"
+            },
+            {
+                "id": 2,
+                "name": {
+                    "first": "Yang",
+                    "last": "Pace"
+                },
+                "type": "personal"
+            }
+        ]
+    },
+    {
+        "_id": "54a43171f139e63d6579121e",
+        "user_id": 6,
+        "name": {
+            "first": "Acevedo",
+            "last": "Morales"
+        },
+        "friends": [
+            {
+                "id": 0,
+                "name": {
+                    "first": "Payne",
+                    "last": "Berry"
+                },
+                "type": "personal"
+            },
+            {
+                "id": 1,
+                "name": {
+                    "first": "Rene",
+                    "last": "Valenzuela"
+                },
+                "type": "personal"
+            },
+            {
+                "id": 2,
+                "name": {
+                    "first": "Dora",
+                    "last": "Gallegos"
+                },
+                "type": "work"
+            }
+        ]
+    },
+    {
+        "_id": "54a431719783cef80876dde8",
+        "user_id": 7,
+        "name": {
+            "first": "Cervantes",
+            "last": "Marquez"
+        },
+        "friends": [
+            {
+                "id": 0,
+                "name": {
+                    "first": "Maxwell",
+                    "last": "Norman"
+                },
+                "type": "personal"
+            },
+            {
+                "id": 1,
+                "name": {
+                    "first": "Shields",
+                    "last": "Bass"
+                },
+                "type": "personal"
+            },
+            {
+                "id": 2,
+                "name": {
+                    "first": "Luz",
+                    "last": "Jacobson"
+                },
+                "type": "work"
+            }
+        ]
+    },
+    {
+        "_id": "54a43171ecc7540d1f7aceae",
+        "user_id": 8,
+        "name": {
+            "first": "West",
+            "last": "Morrow"
+        },
+        "friends": [
+            {
+                "id": 0,
+                "name": {
+                    "first": "Townsend",
+                    "last": "Dixon"
+                },
+                "type": "personal"
+            },
+            {
+                "id": 1,
+                "name": {
+                    "first": "Callahan",
+                    "last": "Buck"
+                },
+                "type": "personal"
+            },
+            {
+                "id": 2,
+                "name": {
+                    "first": "Rachel",
+                    "last": "Fletcher"
+                },
+                "type": "personal"
+            }
+        ]
+    },
+    {
+        "_id": "54a4317113e831f4af041a0a",
+        "user_id": 9,
+        "name": {
+            "first": "Cotton",
+            "last": "House"
+        },
+        "friends": [
+            {
+                "id": 0,
+                "name": {
+                    "first": "Mckenzie",
+                    "last": "Medina"
+                },
+                "type": "personal"
+            },
+            {
+                "id": 1,
+                "name": {
+                    "first": "Cecilia",
+                    "last": "Miles"
+                },
+                "type": "work"
+            },
+            {
+                "id": 2,
+                "name": {
+                    "first": "Guerra",
+                    "last": "Cervantes"
+                },
+                "type": "work"
+            }
+        ]
+    },
+    {
+        "_id": "54a43171686eb1f48ebcbe01",
+        "user_id": 10,
+        "name": {
+            "first": "Wright",
+            "last": "Rivas"
+        },
+        "friends": [
+            {
+                "id": 0,
+                "name": {
+                    "first": "Campos",
+                    "last": "Freeman"
+                },
+                "type": "personal"
+            },
+            {
+                "id": 1,
+                "name": {
+                    "first": "Christian",
+                    "last": "Ferguson"
+                },
+                "type": "personal"
+            },
+            {
+                "id": 2,
+                "name": {
+                    "first": "Doreen",
+                    "last": "Wilder"
+                },
+                "type": "work"
+            }
+        ]
+    },
+    {
+        "_id": "54a43171a4f3d5638c162f4f",
+        "user_id": 11,
+        "name": {
+            "first": "Lorene",
+            "last": "Dorsey"
+        },
+        "friends": [
+            {
+                "id": 0,
+                "name": {
+                    "first": "Gibbs",
+                    "last": "Mccarty"
+                },
+                "type": "personal"
+            },
+            {
+                "id": 1,
+                "name": {
+                    "first": "Neal",
+                    "last": "Franklin"
+                },
+                "type": "work"
+            },
+            {
+                "id": 2,
+                "name": {
+                    "first": "Kristy",
+                    "last": "Head"
+                },
+                "type": "personal"
+            }
+        ]
+    },
+    {
+        "_id": "54a431719faa420a5b4fbeb0",
+        "user_id": 12,
+        "name": {
+            "first": "Juanita",
+            "last": "Cook"
+        },
+        "friends": [
+            {
+                "id": 0,
+                "name": {
+                    "first": "Wilkins",
+                    "last": "Chang"
+                },
+                "type": "work"
+            },
+            {
+                "id": 1,
+                "name": {
+                    "first": "Haney",
+                    "last": "Rivera"
+                },
+                "type": "work"
+            },
+            {
+                "id": 2,
+                "name": {
+                    "first": "Lauren",
+                    "last": "Manning"
+                },
+                "type": "work"
+            }
+        ]
+    },
+    {
+        "_id": "54a43171e65d35f9ee8c53c0",
+        "user_id": 13,
+        "name": {
+            "first": "Levy",
+            "last": "Osborn"
+        },
+        "friends": [
+            {
+                "id": 0,
+                "name": {
+                    "first": "Vinson",
+                    "last": "Vargas"
+                },
+                "type": "work"
+            },
+            {
+                "id": 1,
+                "name": {
+                    "first": "Felicia",
+                    "last": "Beach"
+                },
+                "type": "work"
+            },
+            {
+                "id": 2,
+                "name": {
+                    "first": "Nadine",
+                    "last": "Kemp"
+                },
+                "type": "work"
+            }
+        ]
+    },
+    {
+        "_id": "54a4317132f2c81561833259",
+        "user_id": 14,
+        "name": {
+            "first": "Christina",
+            "last": "Raymond"
+        },
+        "friends": [
+            {
+                "id": 0,
+                "name": {
+                    "first": "Herrera",
+                    "last": "Walton"
+                },
+                "type": "work"
+            },
+            {
+                "id": 1,
+                "name": {
+                    "first": "Hahn",
+                    "last": "Rutledge"
+                },
+                "type": "work"
+            },
+            {
+                "id": 2,
+                "name": {
+                    "first": "Stacie",
+                    "last": "Harding"
+                },
+                "type": "work"
+            }
+        ]
+    }
+]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb-mango/blob/aa4edf42/test/limit_docs.py
----------------------------------------------------------------------
diff --git a/test/limit_docs.py b/test/limit_docs.py
new file mode 100644
index 0000000..53ab523
--- /dev/null
+++ b/test/limit_docs.py
@@ -0,0 +1,408 @@
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+import copy
+
+
+def setup(db, index_type="view"):
+    db.recreate()
+    db.save_docs(copy.deepcopy(DOCS))
+    if index_type == "view":
+        add_view_indexes(db)
+    elif index_type == "text":
+        add_text_indexes(db)
+
+
+def add_text_indexes(db):
+    db.create_text_index()
+
+
+DOCS =  [
+  {
+    "_id": "54af50626de419f5109c962f",
+    "user_id": 0,
+    "age": 10
+  },
+  {
+    "_id": "54af50622071121b25402dc3",
+    "user_id": 1,
+    "age": 11
+
+  },
+  {
+    "_id": "54af50623809e19159a3cdd0",
+    "user_id": 2,
+    "age": 12
+  },
+  {
+    "_id": "54af50629f45a0f49a441d01",
+    "user_id": 3,
+    "age": 13
+
+  },
+  {
+    "_id": "54af50620f1755c22359a362",
+    "user_id": 4,
+    "age": 14
+  },
+  {
+    "_id": "54af5062dd6f6c689ad2ca23",
+    "user_id": 5,
+    "age": 15
+  },
+  {
+    "_id": "54af50623e89b432be1187b8",
+    "user_id": 6,
+    "age": 16
+  },
+  {
+    "_id": "54af5062932a00270a3b5ab0",
+    "user_id": 7,
+    "age": 17
+
+  },
+  {
+    "_id": "54af5062df773d69174e3345",
+    "filtered_array" : [1, 2, 3],
+    "age": 18
+  },
+  {
+    "_id": "54af50629c1153b9e21e346d",
+    "filtered_array" : [1, 2, 3],
+    "age": 19
+  },
+  {
+    "_id": "54af5062dabb7cc4b60e0c95",
+    "user_id": 10,
+    "age": 20
+  },
+  {
+    "_id": "54af5062204996970a4439a2",
+    "user_id": 11,
+    "age": 21
+  },
+  {
+    "_id": "54af50629cea39e8ea52bfac",
+    "user_id": 12,
+    "age": 22
+  },
+  {
+    "_id": "54af50620597c094f75db2a1",
+    "user_id": 13,
+    "age": 23
+  },
+  {
+    "_id": "54af50628d4048de0010723c",
+    "user_id": 14,
+    "age": 24
+  },
+  {
+    "_id": "54af5062f339b6f44f52faf6",
+    "user_id": 15,
+    "age": 25
+  },
+  {
+    "_id": "54af5062a893f17ea4402031",
+    "user_id": 16,
+    "age": 26
+  },
+  {
+    "_id": "54af5062323dbc7077deb60a",
+    "user_id": 17,
+    "age": 27
+  },
+  {
+    "_id": "54af506224db85bd7fcd0243",
+    "filtered_array" : [1, 2, 3],
+    "age": 28
+  },
+  {
+    "_id": "54af506255bb551c9cc251bf",
+    "filtered_array" : [1, 2, 3],
+    "age": 29
+  },
+  {
+    "_id": "54af50625a97394e07d718a1",
+    "filtered_array" : [1, 2, 3],
+    "age": 30
+  },
+  {
+    "_id": "54af506223f51d586b4ef529",
+    "user_id": 21,
+    "age": 31
+  },
+  {
+    "_id": "54af50622740dede7d6117b7",
+    "user_id": 22,
+    "age": 32
+  },
+  {
+    "_id": "54af50624efc87684a52e8fb",
+    "user_id": 23,
+    "age": 33
+  },
+  {
+    "_id": "54af5062f40932760347799c",
+    "user_id": 24,
+    "age": 34
+  },
+  {
+    "_id": "54af5062d9f7361951ac645d",
+    "user_id": 25,
+    "age": 35
+  },
+  {
+    "_id": "54af5062f89aef302b37c3bc",
+    "filtered_array" : [1, 2, 3],
+    "age": 36
+  },
+  {
+    "_id": "54af5062498ec905dcb351f8",
+    "filtered_array" : [1, 2, 3],
+    "age": 37
+  },
+  {
+    "_id": "54af5062b1d2f2c5a85bdd7e",
+    "user_id": 28,
+    "age": 38
+  },
+  {
+    "_id": "54af50625061029c0dd942b5",
+    "filtered_array" : [1, 2, 3],
+    "age": 39
+  },
+  {
+    "_id": "54af50628b0d08a1d23c030a",
+    "user_id": 30,
+    "age": 40
+  },
+  {
+    "_id": "54af506271b6e3119eb31d46",
+    "filtered_array" : [1, 2, 3],
+    "age": 41
+  },
+  {
+    "_id": "54af5062b69f46424dfcf3e5",
+    "user_id": 32,
+    "age": 42
+  },
+  {
+    "_id": "54af5062ed00c7dbe4d1bdcf",
+    "user_id": 33,
+    "age": 43
+  },
+  {
+    "_id": "54af5062fb64e45180c9a90d",
+    "user_id": 34,
+    "age": 44
+  },
+  {
+    "_id": "54af5062241c72b067127b09",
+    "user_id": 35,
+    "age": 45
+  },
+  {
+    "_id": "54af50626a467d8b781a6d06",
+    "user_id": 36,
+    "age": 46
+  },
+  {
+    "_id": "54af50620e992d60af03bf86",
+    "filtered_array" : [1, 2, 3],
+    "age": 47
+  },
+  {
+    "_id": "54af506254f992aa3c51532f",
+    "user_id": 38,
+    "age": 48
+  },
+  {
+    "_id": "54af5062e99b20f301de39b9",
+    "user_id": 39,
+    "age": 49
+  },
+  {
+    "_id": "54af50624fbade6b11505b5d",
+    "user_id": 40,
+    "age": 50
+  },
+  {
+    "_id": "54af506278ad79b21e807ae4",
+    "user_id": 41,
+    "age": 51
+  },
+  {
+    "_id": "54af5062fc7a1dcb33f31d08",
+    "user_id": 42,
+    "age": 52
+  },
+  {
+    "_id": "54af5062ea2c954c650009cf",
+    "user_id": 43,
+    "age": 53
+  },
+  {
+    "_id": "54af506213576c2f09858266",
+    "user_id": 44,
+    "age": 54
+  },
+  {
+    "_id": "54af50624a05ac34c994b1c0",
+    "user_id": 45,
+    "age": 55
+  },
+  {
+    "_id": "54af50625a624983edf2087e",
+    "user_id": 46,
+    "age": 56
+  },
+  {
+    "_id": "54af50623de488c49d064355",
+    "user_id": 47,
+    "age": 57
+  },
+  {
+    "_id": "54af5062628b5df08661a9d5",
+    "user_id": 48,
+    "age": 58
+  },
+  {
+    "_id": "54af50620c706fc23032ae62",
+    "user_id": 49,
+    "age": 59
+  },
+  {
+    "_id": "54af5062509f1e2371fe1da4",
+    "user_id": 50,
+    "age": 60
+  },
+  {
+    "_id": "54af50625e96b22436791653",
+    "user_id": 51,
+    "age": 61
+  },
+  {
+    "_id": "54af5062a9cb71463bb9577f",
+    "user_id": 52,
+    "age": 62
+  },
+  {
+    "_id": "54af50624fea77a4221a4baf",
+    "user_id": 53,
+    "age": 63
+  },
+  {
+    "_id": "54af5062c63df0a147d2417e",
+    "user_id": 54,
+    "age": 64
+  },
+  {
+    "_id": "54af50623c56d78029316c9f",
+    "user_id": 55,
+    "age": 65
+  },
+  {
+    "_id": "54af5062167f6e13aa0dd014",
+    "user_id": 56,
+    "age": 66
+  },
+  {
+    "_id": "54af50621558abe77797d137",
+    "filtered_array" : [1, 2, 3],
+    "age": 67
+  },
+  {
+    "_id": "54af50624d5b36aa7cb5fa77",
+    "user_id": 58,
+    "age": 68
+  },
+  {
+    "_id": "54af50620d79118184ae66bd",
+    "user_id": 59,
+    "age": 69
+  },
+  {
+    "_id": "54af5062d18aafa5c4ca4935",
+    "user_id": 60,
+    "age": 71
+  },
+  {
+    "_id": "54af5062fd22a409649962f4",
+    "filtered_array" : [1, 2, 3],
+    "age": 72
+  },
+  {
+    "_id": "54af5062e31045a1908e89f9",
+    "user_id": 62,
+    "age": 73
+  },
+  {
+    "_id": "54af50624c062fcb4c59398b",
+    "user_id": 63,
+    "age": 74
+  },
+  {
+    "_id": "54af506241ec83430a15957f",
+    "user_id": 64,
+    "age": 75
+  },
+  {
+    "_id": "54af506224d0f888ae411101",
+    "user_id": 65,
+    "age": 76
+  },
+  {
+    "_id": "54af506272a971c6cf3ab6b8",
+    "user_id": 66,
+    "age": 77
+  },
+  {
+    "_id": "54af506221e25b485c95355b",
+    "user_id": 67,
+    "age": 78
+  },
+  {
+    "_id": "54af5062800f7f2ca73e9623",
+    "user_id": 68,
+    "age": 79
+  },
+  {
+    "_id": "54af5062bc962da30740534a",
+    "user_id": 69,
+    "age": 80
+  },
+  {
+    "_id": "54af50625102d6e210fc2efd",
+    "filtered_array" : [1, 2, 3],
+    "age": 81
+  },
+  {
+    "_id": "54af5062e014b9d039f02c5e",
+    "user_id": 71,
+    "age": 82
+  },
+  {
+    "_id": "54af5062fbd5e801dd217515",
+    "user_id": 72,
+    "age": 83
+  },
+  {
+    "_id": "54af50629971992b658fcb88",
+    "user_id": 73,
+    "age": 84
+  },
+  {
+    "_id": "54af5062607d53416c30bafd",
+    "filtered_array" : [1, 2, 3],
+    "age": 85
+  }
+]

http://git-wip-us.apache.org/repos/asf/couchdb-mango/blob/aa4edf42/test/mango.py
----------------------------------------------------------------------
diff --git a/test/mango.py b/test/mango.py
index 5b022b8..79545e1 100644
--- a/test/mango.py
+++ b/test/mango.py
@@ -17,7 +17,9 @@ import uuid
 
 import requests
 
+import friend_docs
 import user_docs
+import limit_docs
 
 
 def random_db_name():
@@ -96,6 +98,31 @@ class Database(object):
         r.raise_for_status()
         return r.json()["result"] == "created"
 
+    def create_text_index(self, analyzer=None, selector=None, idx_type="text",
+        default_field=None, fields=None, name=None, ddoc=None):
+        body = {
+            "index": {
+            },
+            "type": idx_type,
+            "w": 3,
+        }
+        if name is not None:
+            body["name"] = name
+        if analyzer is not None:
+            body["index"]["default_analyzer"] = analyzer
+        if default_field is not None:
+            body["index"]["default_field"] = default_field
+        if selector is not None:
+            body["selector"] = selector
+        if fields is not None:
+            body["index"]["fields"] = fields
+        if ddoc is not None:
+            body["ddoc"] = ddoc
+        body = json.dumps(body)
+        r = self.sess.post(self.path("_index"), data=body)
+        r.raise_for_status()
+        return r.json()["result"] == "created"
+
     def list_indexes(self):
         r = self.sess.get(self.path("_index"))
         r.raise_for_status()
@@ -107,7 +134,8 @@ class Database(object):
         r.raise_for_status()
 
     def find(self, selector, limit=25, skip=0, sort=None, fields=None,
-                r=1, conflicts=False, explain=False, use_index=None):
+                r=1, conflicts=False, use_index=None, explain=False,
+                bookmark=None, return_raw=False):
         body = {
             "selector": selector,
             "use_index": use_index,
@@ -120,6 +148,8 @@ class Database(object):
             body["sort"] = sort
         if fields is not None:
             body["fields"] = fields
+        if bookmark is not None:
+            body["bookmark"] = bookmark
         body = json.dumps(body)
         if explain:
             path = self.path("_explain")
@@ -127,7 +157,7 @@ class Database(object):
             path = self.path("_find")
         r = self.sess.post(path, data=body)
         r.raise_for_status()
-        if explain:
+        if explain or return_raw:
             return r.json()
         else:
             return r.json()["docs"]
@@ -183,3 +213,10 @@ class FriendDocsTextTests(DbPerClass):
     def setUpClass(klass):
         super(FriendDocsTextTests, klass).setUpClass()
         friend_docs.setup(klass.db, index_type="text")
+
+class LimitDocsTextTests(DbPerClass):
+
+    @classmethod
+    def setUpClass(klass):
+        super(LimitDocsTextTests, klass).setUpClass()
+        limit_docs.setup(klass.db, index_type="text")

http://git-wip-us.apache.org/repos/asf/couchdb-mango/blob/aa4edf42/test/user_docs.py
----------------------------------------------------------------------
diff --git a/test/user_docs.py b/test/user_docs.py
index 972eafc..05eabbb 100644
--- a/test/user_docs.py
+++ b/test/user_docs.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 # Licensed under the Apache License, Version 2.0 (the "License"); you may not
 # use this file except in compliance with the License. You may obtain a copy of
 # the License at
@@ -9,8 +10,7 @@
 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 # License for the specific language governing permissions and limitations under
 # the License.
-#
-# -*- coding: utf-8 -*-
+
 """
 Generated with http://www.json-generator.com/
 
@@ -351,7 +351,8 @@ DOCS = [
             "Erlang",
             "Python"
         ],
-        "exists_array" : ["should", "exist", "array1"]
+        "exists_array" : ["should", "exist", "array1"],
+        "complex_field_value" : "+-(){}[]^~&&*||\"\\/?:!"
     },
     {
         "_id": "e900001d-bc48-48a6-9b1a-ac9a1f5d1a03",
@@ -456,16 +457,11 @@ DOCS = [
             "C",
             "Ruby",
             "Ruby"
-        ],
-        "utf8-1[]:string" : "string",
-        "utf8-2[]:boolean[]" : True,
-        "utf8-3[]:number" : 9,
-        "utf8-3[]:null" : None
+        ]
     },
     {
         "_id": "c78c529f-0b07-4947-90a6-d6b7ca81da62",
         "user_id": 14,
-        "«ταБЬℓσ»" : "utf-8",
         "name": {
             "first": "Faith",
             "last": "Hess"


Mime
View raw message