mirror of
https://github.com/koniu/recoll-webui.git
synced 2025-10-03 09:49:25 +02:00
recoll 1.19 compatibility changes
This commit is contained in:
parent
740f507c0e
commit
1f91a59af6
3 changed files with 22 additions and 7 deletions
|
@ -11,7 +11,7 @@
|
|||
%if len(d['ipath']) > 0:
|
||||
<div class="search-result-ipath">[{{d['ipath']}}]</div>
|
||||
%end
|
||||
%if len(d['author']) > 0:
|
||||
%if d.has_key('author') and len(d['author']) > 0:
|
||||
<div class="search-result-author">{{d['author']}}</div>
|
||||
%end
|
||||
<div class="search-result-url">
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!env python
|
||||
#!/usr/bin/env python
|
||||
import bottle
|
||||
import webui
|
||||
|
||||
|
|
21
webui.py
21
webui.py
|
@ -3,7 +3,11 @@
|
|||
import os
|
||||
import bottle
|
||||
import time
|
||||
import recoll
|
||||
try:
|
||||
from recoll import recoll
|
||||
except:
|
||||
import recoll
|
||||
|
||||
import datetime
|
||||
import glob
|
||||
import hashlib
|
||||
|
@ -184,12 +188,23 @@ def recoll_search(q):
|
|||
config['perpage'] = nres
|
||||
q['page'] = 1
|
||||
offset = (q['page'] - 1) * config['perpage']
|
||||
|
||||
if type(query.next) == int:
|
||||
query.next = offset
|
||||
while query.next >= 0 and query.next < offset + config['perpage'] and query.next < nres:
|
||||
else:
|
||||
query.scroll(offset)
|
||||
for i in range(config['perpage']):
|
||||
try:
|
||||
doc = query.fetchone()
|
||||
except:
|
||||
break
|
||||
d = {}
|
||||
for f in FIELDS:
|
||||
d[f] = getattr(doc, f).encode('utf-8')
|
||||
v = getattr(doc, f)
|
||||
if v is not None:
|
||||
d[f] = v.encode('utf-8')
|
||||
else:
|
||||
d[f] = ''
|
||||
d['label'] = select([d['title'], d['filename'], '?'], [None, ''])
|
||||
d['sha'] = hashlib.sha1(d['url']+d['ipath']).hexdigest()
|
||||
d['time'] = timestr(d['mtime'], config['timefmt'])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue