mirror of
				https://github.com/searxng/searxng.git
				synced 2025-10-30 10:12:31 -04:00 
			
		
		
		
	Merge pull request #1846 from piplongrun/autocomplete_swisscows
Add Swisscows autocomplete option
This commit is contained in:
		
						commit
						09f4e2cd31
					
				| @ -165,6 +165,14 @@ def startpage(query, lang): | |||||||
|     return [] |     return [] | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | def swisscows(query, lang): | ||||||
|  |     # swisscows autocompleter | ||||||
|  |     url = 'https://swisscows.ch/api/suggest?{query}&itemsCount=5' | ||||||
|  | 
 | ||||||
|  |     resp = loads(get(url.format(query=urlencode({'query': query}))).text) | ||||||
|  |     return resp | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| def qwant(query, lang): | def qwant(query, lang): | ||||||
|     # qwant autocompleter (additional parameter : lang=en_en&count=xxx ) |     # qwant autocompleter (additional parameter : lang=en_en&count=xxx ) | ||||||
|     url = 'https://api.qwant.com/api/suggest?{query}' |     url = 'https://api.qwant.com/api/suggest?{query}' | ||||||
| @ -196,6 +204,7 @@ backends = {'dbpedia': dbpedia, | |||||||
|             'duckduckgo': duckduckgo, |             'duckduckgo': duckduckgo, | ||||||
|             'google': google, |             'google': google, | ||||||
|             'startpage': startpage, |             'startpage': startpage, | ||||||
|  |             'swisscows': swisscows, | ||||||
|             'qwant': qwant, |             'qwant': qwant, | ||||||
|             'wikipedia': wikipedia |             'wikipedia': wikipedia | ||||||
|             } |             } | ||||||
|  | |||||||
| @ -4,7 +4,7 @@ general: | |||||||
| 
 | 
 | ||||||
| search: | search: | ||||||
|     safe_search : 0 # Filter results. 0: None, 1: Moderate, 2: Strict |     safe_search : 0 # Filter results. 0: None, 1: Moderate, 2: Strict | ||||||
|     autocomplete : "" # Existing autocomplete backends: "dbpedia", "duckduckgo", "google", "startpage", "wikipedia" - leave blank to turn it off by default |     autocomplete : "" # Existing autocomplete backends: "dbpedia", "duckduckgo", "google", "startpage", "swisscows", "qwant", "wikipedia" - leave blank to turn it off by default | ||||||
|     default_lang : "" # Default search language - leave blank to detect from browser information or use codes from 'languages.py' |     default_lang : "" # Default search language - leave blank to detect from browser information or use codes from 'languages.py' | ||||||
|     ban_time_on_fail : 5 # ban time in seconds after engine errors |     ban_time_on_fail : 5 # ban time in seconds after engine errors | ||||||
|     max_ban_time_on_fail : 120 # max ban time in seconds after engine errors |     max_ban_time_on_fail : 120 # max ban time in seconds after engine errors | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user