1
0
Fork 0
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:
koniu 2012-12-21 14:44:22 +00:00
parent 56453c4503
commit b9b91f729f
2 changed files with 4 additions and 1 deletions

View file

@ -3,6 +3,8 @@
<form action="set" method="get">
<b>Find similar</b> <small class="gray">(1 or 0, show "squats" and "squatter")</small>
<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>
<b>Context words</b> <small class="gray">(number of words shown in search results)</small>
<input name="context" value={{context}}>

View file

@ -27,6 +27,7 @@ DEFAULTS = {
'timefmt': '%c',
'dirdepth': 3,
'maxchars': 500,
'maxresults': 100,
}
# sort fields/labels
@ -165,7 +166,7 @@ def recoll_search(q, sort, ascending):
nres = query.execute(q, int(config['stem']))
except:
nres = 0
for i in range(0, nres):
for i in range(0, min(nres, int(config['maxresults']))):
doc = query.fetchone()
d = {}
for f in FIELDS: