mirror of
				https://github.com/searxng/searxng
				synced 2024-01-01 19:24:07 +01:00 
			
		
		
		
	update comment
This commit is contained in:
		
							parent
							
								
									6b058962e1
								
							
						
					
					
						commit
						e39d9fe542
					
				
					 1 changed files with 6 additions and 5 deletions
				
			
		|  | @ -106,8 +106,13 @@ def score_results(results): | ||||||
|             res['host'] = res['host'].replace('www.', '', 1) |             res['host'] = res['host'].replace('www.', '', 1) | ||||||
| 
 | 
 | ||||||
|         res['engines'] = [res['engine']] |         res['engines'] = [res['engine']] | ||||||
|  | 
 | ||||||
|         weight = 1.0 |         weight = 1.0 | ||||||
| 
 | 
 | ||||||
|  |         # strip multiple spaces and cariage returns from content | ||||||
|  |         if 'content' in res: | ||||||
|  |             res['content'] = re.sub(' +', ' ', res['content'].strip().replace('\n', '')) | ||||||
|  | 
 | ||||||
|         # get weight of this engine if possible |         # get weight of this engine if possible | ||||||
|         if hasattr(engines[res['engine']], 'weight'): |         if hasattr(engines[res['engine']], 'weight'): | ||||||
|             weight = float(engines[res['engine']].weight) |             weight = float(engines[res['engine']].weight) | ||||||
|  | @ -115,12 +120,8 @@ def score_results(results): | ||||||
|         # calculate score for that engine |         # calculate score for that engine | ||||||
|         score = int((flat_len - i) / engines_len) * weight + 1 |         score = int((flat_len - i) / engines_len) * weight + 1 | ||||||
| 
 | 
 | ||||||
|         duplicated = False |  | ||||||
| 
 |  | ||||||
|         # check for duplicates |         # check for duplicates | ||||||
|         if 'content' in res: |         duplicated = False | ||||||
|             res['content'] = re.sub(' +', ' ', res['content'].strip().replace('\n', '')) |  | ||||||
| 
 |  | ||||||
|         for new_res in results: |         for new_res in results: | ||||||
|             # remove / from the end of the url if required |             # remove / from the end of the url if required | ||||||
|             p1 = res['parsed_url'].path[:-1] if res['parsed_url'].path.endswith('/') else res['parsed_url'].path  # noqa |             p1 = res['parsed_url'].path[:-1] if res['parsed_url'].path.endswith('/') else res['parsed_url'].path  # noqa | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Dalf
						Dalf