예제 #1
0
    def test_create_index(self):
        index_name = "some-index"
        client = self.get_client()
        schema = Schema()
        index = schema.index(index_name, track_existence=True, keys=True)
        client.sync_schema(schema)
        try:
            schema = client.schema()
            self.assertTrue(schema.has_index(index_name))
            index = schema.index(index_name)
            self.assertTrue(index.keys)
            self.assertTrue(index.track_existence)
            self.assertNotEqual(0, index.shard_width)

        finally:
            client.delete_index(index)
예제 #2
0
 def test_has_index(self):
     schema = Schema()
     schema.index("some-index")
     self.assertTrue(schema.has_index("some-index"))
     self.assertFalse(schema.has_index("another-index"))