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:
|
%if len(d['ipath']) > 0:
|
||||||
<div class="search-result-ipath">[{{d['ipath']}}]</div>
|
<div class="search-result-ipath">[{{d['ipath']}}]</div>
|
||||||
%end
|
%end
|
||||||
%if len(d['author']) > 0:
|
%if d.has_key('author') and len(d['author']) > 0:
|
||||||
<div class="search-result-author">{{d['author']}}</div>
|
<div class="search-result-author">{{d['author']}}</div>
|
||||||
%end
|
%end
|
||||||
<div class="search-result-url">
|
<div class="search-result-url">
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!env python
|
#!/usr/bin/env python
|
||||||
import bottle
|
import bottle
|
||||||
import webui
|
import webui
|
||||||
|
|
||||||
|
|
25
webui.py
25
webui.py
|
@ -3,7 +3,11 @@
|
||||||
import os
|
import os
|
||||||
import bottle
|
import bottle
|
||||||
import time
|
import time
|
||||||
import recoll
|
try:
|
||||||
|
from recoll import recoll
|
||||||
|
except:
|
||||||
|
import recoll
|
||||||
|
|
||||||
import datetime
|
import datetime
|
||||||
import glob
|
import glob
|
||||||
import hashlib
|
import hashlib
|
||||||
|
@ -184,12 +188,23 @@ def recoll_search(q):
|
||||||
config['perpage'] = nres
|
config['perpage'] = nres
|
||||||
q['page'] = 1
|
q['page'] = 1
|
||||||
offset = (q['page'] - 1) * config['perpage']
|
offset = (q['page'] - 1) * config['perpage']
|
||||||
query.next = offset
|
|
||||||
while query.next >= 0 and query.next < offset + config['perpage'] and query.next < nres:
|
if type(query.next) == int:
|
||||||
doc = query.fetchone()
|
query.next = offset
|
||||||
|
else:
|
||||||
|
query.scroll(offset)
|
||||||
|
for i in range(config['perpage']):
|
||||||
|
try:
|
||||||
|
doc = query.fetchone()
|
||||||
|
except:
|
||||||
|
break
|
||||||
d = {}
|
d = {}
|
||||||
for f in FIELDS:
|
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['label'] = select([d['title'], d['filename'], '?'], [None, ''])
|
||||||
d['sha'] = hashlib.sha1(d['url']+d['ipath']).hexdigest()
|
d['sha'] = hashlib.sha1(d['url']+d['ipath']).hexdigest()
|
||||||
d['time'] = timestr(d['mtime'], config['timefmt'])
|
d['time'] = timestr(d['mtime'], config['timefmt'])
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue