Merge pull request #353 from Cqoicebordel/languages

New feature : language per search engine !
This commit is contained in:
Adam Tauber 2015-06-03 11:41:02 -04:00
commit cdf931f949

View File

@ -237,7 +237,7 @@ def score_results(results):
for k in categoryPositions: for k in categoryPositions:
v = categoryPositions[k]['index'] v = categoryPositions[k]['index']
if v >= index: if v >= index:
categoryPositions[k]['index'] = v+1 categoryPositions[k]['index'] = v + 1
# update this category # update this category
current['count'] -= 1 current['count'] -= 1
@ -306,7 +306,7 @@ def merge_infoboxes(infoboxes):
if add_infobox: if add_infobox:
results.append(infobox) results.append(infobox)
infoboxes_id[infobox_id] = len(results)-1 infoboxes_id[infobox_id] = len(results) - 1
return results return results
@ -472,7 +472,12 @@ class Search(object):
request_params['category'] = selected_engine['category'] request_params['category'] = selected_engine['category']
request_params['started'] = time() request_params['started'] = time()
request_params['pageno'] = self.pageno request_params['pageno'] = self.pageno
if hasattr(engine, 'language'):
request_params['language'] = engine.language
else:
request_params['language'] = self.lang request_params['language'] = self.lang
try: try:
# 0 = None, 1 = Moderate, 2 = Strict # 0 = None, 1 = Moderate, 2 = Strict
request_params['safesearch'] = int(request.cookies.get('safesearch', 1)) request_params['safesearch'] = int(request.cookies.get('safesearch', 1))