本文整理汇总了Python中scorched.SolrInterface.delete_by_ids方法的典型用法代码示例。如果您正苦于以下问题:Python SolrInterface.delete_by_ids方法的具体用法?Python SolrInterface.delete_by_ids怎么用?Python SolrInterface.delete_by_ids使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类scorched.SolrInterface
的用法示例。
在下文中一共展示了SolrInterface.delete_by_ids方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_query
# 需要导入模块: from scorched import SolrInterface [as 别名]
# 或者: from scorched.SolrInterface import delete_by_ids [as 别名]
def test_query(self):
dsn = os.environ.get("SOLR_URL", "http://localhost:8983/solr")
si = SolrInterface(dsn)
si.add(self.docs)
si.commit()
res = si.query(genre_s="fantasy").execute()
self.assertEqual(res.result.numFound, 3)
# delete
si.delete_by_ids(res.result.docs[0]["id"])
si.commit()
res = si.query(genre_s="fantasy").execute()
self.assertEqual(res.result.numFound, 2)
res = si.query(genre_s="fantasy").execute(constructor=Book)
# test constructor
self.assertEqual(
[x.title for x in res.result.docs], ["The Sea of Monsters", "Sophie's World : The Greek Philosophers"]
)
示例2: test_rollback
# 需要导入模块: from scorched import SolrInterface [as 别名]
# 或者: from scorched.SolrInterface import delete_by_ids [as 别名]
def test_rollback(self):
dsn = os.environ.get("SOLR_URL",
"http://localhost:8983/solr")
si = SolrInterface(dsn)
si.delete_all()
si.add(self.docs)
si.commit()
res = si.query(genre_s="fantasy").execute()
self.assertEqual(res.result.numFound, 3)
# delete
res = si.delete_by_ids(res.result.docs[0]['id'])
self.assertEqual(res.status, 0)
# rollback
res = si.rollback()
self.assertEqual(res.status, 0)
res = si.query(genre_s="fantasy").execute()
self.assertEqual(res.result.numFound, 3)