mirror of
https://github.com/koniu/recoll-webui.git
synced 2025-10-03 09:49:25 +02:00
py: disable pagination for json/csv
This commit is contained in:
parent
753f35de80
commit
375800bbf6
1 changed files with 5 additions and 2 deletions
7
webui.py
7
webui.py
|
@ -149,7 +149,7 @@ def get_query():
|
||||||
'dir': select([bottle.request.query.get('dir'), '', '<all>'], [None, '']),
|
'dir': select([bottle.request.query.get('dir'), '', '<all>'], [None, '']),
|
||||||
'sort': select([bottle.request.query.get('sort'), SORTS[0][0]]),
|
'sort': select([bottle.request.query.get('sort'), SORTS[0][0]]),
|
||||||
'ascending': int(select([bottle.request.query.get('ascending'), 0])),
|
'ascending': int(select([bottle.request.query.get('ascending'), 0])),
|
||||||
'page': int(select([bottle.request.query.get('page'), 1])),
|
'page': int(select([bottle.request.query.get('page'), 0])),
|
||||||
}
|
}
|
||||||
return query
|
return query
|
||||||
#}}}
|
#}}}
|
||||||
|
@ -180,8 +180,9 @@ def recoll_search(q):
|
||||||
config['maxresults'] = nres
|
config['maxresults'] = nres
|
||||||
if nres > config['maxresults']:
|
if nres > config['maxresults']:
|
||||||
nres = config['maxresults']
|
nres = config['maxresults']
|
||||||
if config['perpage'] == 0:
|
if config['perpage'] == 0 or q['page'] == 0:
|
||||||
config['perpage'] = nres
|
config['perpage'] = nres
|
||||||
|
q['page'] = 1
|
||||||
offset = (q['page'] - 1) * config['perpage']
|
offset = (q['page'] - 1) * config['perpage']
|
||||||
query.next = offset
|
query.next = offset
|
||||||
while query.next >= 0 and query.next < offset + config['perpage'] and query.next < nres:
|
while query.next >= 0 and query.next < offset + config['perpage'] and query.next < nres:
|
||||||
|
@ -232,6 +233,7 @@ def results():
|
||||||
@bottle.route('/json')
|
@bottle.route('/json')
|
||||||
def get_json():
|
def get_json():
|
||||||
query = get_query()
|
query = get_query()
|
||||||
|
query['page'] = 0
|
||||||
qs = query_to_recoll_string(query)
|
qs = query_to_recoll_string(query)
|
||||||
bottle.response.headers['Content-Type'] = 'application/json'
|
bottle.response.headers['Content-Type'] = 'application/json'
|
||||||
bottle.response.headers['Content-Disposition'] = 'attachment; filename=recoll-%s.json' % normalise_filename(qs)
|
bottle.response.headers['Content-Disposition'] = 'attachment; filename=recoll-%s.json' % normalise_filename(qs)
|
||||||
|
@ -243,6 +245,7 @@ def get_json():
|
||||||
@bottle.route('/csv')
|
@bottle.route('/csv')
|
||||||
def get_csv():
|
def get_csv():
|
||||||
query = get_query()
|
query = get_query()
|
||||||
|
query['page'] = 0
|
||||||
qs = query_to_recoll_string(query)
|
qs = query_to_recoll_string(query)
|
||||||
bottle.response.headers['Content-Type'] = 'text/csv'
|
bottle.response.headers['Content-Type'] = 'text/csv'
|
||||||
bottle.response.headers['Content-Disposition'] = 'attachment; filename=recoll-%s.csv' % normalise_filename(qs)
|
bottle.response.headers['Content-Disposition'] = 'attachment; filename=recoll-%s.csv' % normalise_filename(qs)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue