|
@@ -29,7 +29,7 @@ search_category = {'general': 'web',
|
29
|
29
|
|
30
|
30
|
# do search-request
|
31
|
31
|
def request(query, params):
|
32
|
|
- offset = (params['pageno'] - 1) * number_of_results
|
|
32
|
+ offset = (params['pageno']-1) * number_of_results + 1
|
33
|
33
|
categorie = search_category.get(params['category'], 'web')
|
34
|
34
|
|
35
|
35
|
if params['language'] == 'all':
|
|
@@ -78,7 +78,7 @@ def response(resp):
|
78
|
78
|
|
79
|
79
|
# parse results
|
80
|
80
|
for result in search_res['results']:
|
81
|
|
- if result['news'] == 'true':
|
|
81
|
+ if result['news']:
|
82
|
82
|
# timestamp (how many milliseconds have passed between now and the beginning of 1970)
|
83
|
83
|
publishedDate = datetime.datetime.fromtimestamp(result['date']/1000.0)
|
84
|
84
|
|
|
@@ -95,14 +95,14 @@ def response(resp):
|
95
|
95
|
'title': result['title'],
|
96
|
96
|
'content': result['kwic']})
|
97
|
97
|
|
98
|
|
- # append image result if image url is set
|
99
|
|
- # TODO, show results with an image like in faroo
|
100
|
|
- if result['iurl']:
|
101
|
|
- results.append({'template': 'images.html',
|
102
|
|
- 'url': result['url'],
|
103
|
|
- 'title': result['title'],
|
104
|
|
- 'content': result['kwic'],
|
105
|
|
- 'img_src': result['iurl']})
|
|
98
|
+ # append image result if image url is set
|
|
99
|
+ # TODO, show results with an image like in faroo
|
|
100
|
+ if result['iurl']:
|
|
101
|
+ results.append({'template': 'images.html',
|
|
102
|
+ 'url': result['url'],
|
|
103
|
+ 'title': result['title'],
|
|
104
|
+ 'content': result['kwic'],
|
|
105
|
+ 'img_src': result['iurl']})
|
106
|
106
|
|
107
|
107
|
# return results
|
108
|
108
|
return results
|