mirror of
https://github.com/koniu/recoll-webui.git
synced 2025-10-03 17:59:50 +02:00
py: allow limiting the number of results
This commit is contained in:
parent
56453c4503
commit
b9b91f729f
2 changed files with 4 additions and 1 deletions
|
@ -3,6 +3,8 @@
|
||||||
<form action="set" method="get">
|
<form action="set" method="get">
|
||||||
<b>Find similar</b> <small class="gray">(1 or 0, show "squats" and "squatter")</small>
|
<b>Find similar</b> <small class="gray">(1 or 0, show "squats" and "squatter")</small>
|
||||||
<input name="stem" value={{stem}}>
|
<input name="stem" value={{stem}}>
|
||||||
|
<b>Max results</b> <small class="gray">(maximum number of results to show)</small>
|
||||||
|
<input name="maxresults" value={{maxresults}}>
|
||||||
<hr>
|
<hr>
|
||||||
<b>Context words</b> <small class="gray">(number of words shown in search results)</small>
|
<b>Context words</b> <small class="gray">(number of words shown in search results)</small>
|
||||||
<input name="context" value={{context}}>
|
<input name="context" value={{context}}>
|
||||||
|
|
3
webui.py
3
webui.py
|
@ -27,6 +27,7 @@ DEFAULTS = {
|
||||||
'timefmt': '%c',
|
'timefmt': '%c',
|
||||||
'dirdepth': 3,
|
'dirdepth': 3,
|
||||||
'maxchars': 500,
|
'maxchars': 500,
|
||||||
|
'maxresults': 100,
|
||||||
}
|
}
|
||||||
|
|
||||||
# sort fields/labels
|
# sort fields/labels
|
||||||
|
@ -165,7 +166,7 @@ def recoll_search(q, sort, ascending):
|
||||||
nres = query.execute(q, int(config['stem']))
|
nres = query.execute(q, int(config['stem']))
|
||||||
except:
|
except:
|
||||||
nres = 0
|
nres = 0
|
||||||
for i in range(0, nres):
|
for i in range(0, min(nres, int(config['maxresults']))):
|
||||||
doc = query.fetchone()
|
doc = query.fetchone()
|
||||||
d = {}
|
d = {}
|
||||||
for f in FIELDS:
|
for f in FIELDS:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue