logo

searx

My custom branche(s) on searx, a meta-search engine
commit: fce6fb2fa8f1b95d36b8043e0cea160b2f9fc633
parent: 5fbda0dafe5ce7efad04a68de8d6d59a19c4b60c
Author: Adam Tauber <asciimoo@gmail.com>
Date:   Wed,  1 Oct 2014 19:23:44 +0200

Merge pull request #107 from pointhi/float_bug

fix float division by zero bug in score calculation

Diffstat:

Msearx/engines/__init__.py20++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/searx/engines/__init__.py b/searx/engines/__init__.py @@ -142,16 +142,28 @@ def get_engines_stats(): }) for engine in pageloads: - engine['percentage'] = int(engine['avg'] / max_pageload * 100) + if max_pageload: + engine['percentage'] = int(engine['avg'] / max_pageload * 100) + else: + engine['percentage'] = 0 for engine in results: - engine['percentage'] = int(engine['avg'] / max_results * 100) + if max_results: + engine['percentage'] = int(engine['avg'] / max_results * 100) + else: + engine['percentage'] = 0 for engine in scores: - engine['percentage'] = int(engine['avg'] / max_score * 100) + if max_score: + engine['percentage'] = int(engine['avg'] / max_score * 100) + else: + engine['percentage'] = 0 for engine in scores_per_result: - engine['percentage'] = int(engine['avg'] / max_score_per_result * 100) + if max_score_per_result: + engine['percentage'] = int(engine['avg'] / max_score_per_result * 100) + else: + engine['percentage'] = 0 for engine in errors: if max_errors: