2017-08-04 8 views
0

Solrpyがpython.The基本的な使用のためのSolrクライアントでは、次のとおりです。Solrpy pagenationを行う方法?

s = solr.SolrConnection('http://localhost:8080/solr/bt') 
rows = 20 
results = s.query(q, rows=rows) 

pagenationのクエリを実行する方法は?

答えて

0

2つのパラメータstartrowsを使用してページネーションを制御できます。

例start = 0 & rows = 20は最初の20個の結果を与え、start = 20 & rows = 20は結果の次の20個のセットを与えます。直接Solrpyで改ページを行うにはどのように

更新

>>> 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 
+0

? – XieWilliam

関連する問題