forked from Ponysearch/Ponysearch
fix faroo engine
This commit is contained in:
parent
8af2184a45
commit
db4ca4784b
1 changed files with 10 additions and 10 deletions
|
@ -29,7 +29,7 @@ search_category = {'general': 'web',
|
||||||
|
|
||||||
# do search-request
|
# do search-request
|
||||||
def request(query, params):
|
def request(query, params):
|
||||||
offset = (params['pageno'] - 1) * number_of_results
|
offset = (params['pageno']-1) * number_of_results + 1
|
||||||
categorie = search_category.get(params['category'], 'web')
|
categorie = search_category.get(params['category'], 'web')
|
||||||
|
|
||||||
if params['language'] == 'all':
|
if params['language'] == 'all':
|
||||||
|
@ -78,7 +78,7 @@ def response(resp):
|
||||||
|
|
||||||
# parse results
|
# parse results
|
||||||
for result in search_res['results']:
|
for result in search_res['results']:
|
||||||
if result['news'] == 'true':
|
if result['news']:
|
||||||
# timestamp (how many milliseconds have passed between now and the beginning of 1970)
|
# timestamp (how many milliseconds have passed between now and the beginning of 1970)
|
||||||
publishedDate = datetime.datetime.fromtimestamp(result['date']/1000.0)
|
publishedDate = datetime.datetime.fromtimestamp(result['date']/1000.0)
|
||||||
|
|
||||||
|
@ -95,14 +95,14 @@ def response(resp):
|
||||||
'title': result['title'],
|
'title': result['title'],
|
||||||
'content': result['kwic']})
|
'content': result['kwic']})
|
||||||
|
|
||||||
# append image result if image url is set
|
# append image result if image url is set
|
||||||
# TODO, show results with an image like in faroo
|
# TODO, show results with an image like in faroo
|
||||||
if result['iurl']:
|
if result['iurl']:
|
||||||
results.append({'template': 'images.html',
|
results.append({'template': 'images.html',
|
||||||
'url': result['url'],
|
'url': result['url'],
|
||||||
'title': result['title'],
|
'title': result['title'],
|
||||||
'content': result['kwic'],
|
'content': result['kwic'],
|
||||||
'img_src': result['iurl']})
|
'img_src': result['iurl']})
|
||||||
|
|
||||||
# return results
|
# return results
|
||||||
return results
|
return results
|
||||||
|
|
Loading…
Reference in a new issue