fix bug in simple search
This commit is contained in:
parent
bca09fa8ba
commit
82b90adf2d
|
@ -1,3 +1,4 @@
|
||||||
|
import re
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from flask import g, current_app
|
from flask import g, current_app
|
||||||
|
@ -40,8 +41,12 @@ class SimpleSearch(BaseSearch):
|
||||||
res = []
|
res = []
|
||||||
for entry in g.current_wiki.get_index():
|
for entry in g.current_wiki.get_index():
|
||||||
name = filename_to_cname(entry['name'])
|
name = filename_to_cname(entry['name'])
|
||||||
|
name = re.sub(r"//+", '/', name)
|
||||||
if set(query.split()).intersection(name.replace('/', '-').split('-')):
|
if set(query.split()).intersection(name.replace('/', '-').split('-')):
|
||||||
page = g.current_wiki.get_page(name)
|
page = g.current_wiki.get_page(name)
|
||||||
|
|
||||||
|
# this can be None, not sure how
|
||||||
|
if page:
|
||||||
res.append(dict(name=name, content=page['data']))
|
res.append(dict(name=name, content=page['data']))
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue