本文整理汇总了Python中SolrClient.IndexQ.get_all_json_from_indexq方法的典型用法代码示例。如果您正苦于以下问题:Python IndexQ.get_all_json_from_indexq方法的具体用法?Python IndexQ.get_all_json_from_indexq怎么用?Python IndexQ.get_all_json_from_indexq使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SolrClient.IndexQ
的用法示例。
在下文中一共展示了IndexQ.get_all_json_from_indexq方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_get_multi_with_sentinel
# 需要导入模块: from SolrClient import IndexQ [as 别名]
# 或者: from SolrClient.IndexQ import get_all_json_from_indexq [as 别名]
def test_get_multi_with_sentinel(self):
log = logging.getLogger()
index = IndexQ(test_config['indexqbase'], 'testq', size=1, log=log)
q = index.get_multi_q(sentinel='BLAH')
docs = self.rand_docs.get_docs(5000)
docs2 = self.rand_docs.get_docs(5000)
for item in docs + ['BLAH'] + docs2:
q.put(item)
index.join_indexer()
self.assertEqual(docs+docs2, index.get_all_json_from_indexq())
示例2: test_get_multi_q2
# 需要导入模块: from SolrClient import IndexQ [as 别名]
# 或者: from SolrClient.IndexQ import get_all_json_from_indexq [as 别名]
def test_get_multi_q2(self):
log = logging.getLogger()
index = IndexQ(test_config['indexqbase'], 'testq', size = 1, log = log)
q = index.get_multi_q()
docs = self.rand_docs.get_docs(50000)
for item in docs:
q.put(item)
q.put('STOP')
index.join_indexer()
self.assertEqual(docs, index.get_all_json_from_indexq())
示例3: test_thread_pool_mid
# 需要导入模块: from SolrClient import IndexQ [as 别名]
# 或者: from SolrClient.IndexQ import get_all_json_from_indexq [as 别名]
def test_thread_pool_mid(self):
'''
Index data using multiple threads.
Verity that each thread
'''
docs = self.rand_docs.get_docs(5000)
threads = 5
index = IndexQ(test_config['indexqbase'],'testq', size = 1)
with ThreadPool(threads) as p:
p.map(index.add, docs)
index.add(finalize=True)
d = index.get_all_json_from_indexq()
self.assertEqual(sorted(d, key=lambda x: x['id']), sorted(docs, key=lambda x: x['id']))
示例4: test_thread_pool_high
# 需要导入模块: from SolrClient import IndexQ [as 别名]
# 或者: from SolrClient.IndexQ import get_all_json_from_indexq [as 别名]
def test_thread_pool_high(self):
'''
Index data using multiple threads.
Verity that each thread
'''
docs = self.rand_docs.get_docs(25000)
index = IndexQ(test_config['indexqbase'],
'testq',
size=.1,
devel=True)
for dir in ['_todo_dir', '_done_dir']:
[os.remove(x) for x in index.get_all_as_list(dir=dir)]
threads = 25
with ThreadPool(threads) as p:
p.map(index.add, docs)
index.add(finalize=True)
d = index.get_all_json_from_indexq()
self.assertEqual(len(d), len(docs))
self.assertEqual(sorted(d, key=lambda x: x['id']),
sorted(docs, key=lambda x: x['id']))