Solrpy 是 python 的 solr 客户端。基本用途是:
s = solr.SolrConnection('http://localhost:8080/solr/bt')
rows = 20
results = s.query(q, rows=rows)
如何进行分页查询?
您可以使用两个参数start
和rows
来控制分页。
示例 start=0&rows=20 将给出前 20 个结果,start=20&rows=20 将给出接下来的 20 组结果。
更新
>>> response = c.query('test', rows=20)
>>> print response.results.start
0
>>> for match in response:
... print match['id'],
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
>>> response = response.next_batch()
>>> print response.results.start
20