whoosh-community / whoosh

Whoosh is a fast, featureful full-text indexing and searching library implemented in pure Python.
Other
252 stars 37 forks source link

divide by zero error in ReaderCorrector._suggestions #218

Open fortable1999 opened 12 years ago

fortable1999 commented 12 years ago

Original report by Andrew T (Bitbucket: scyclops, GitHub: scyclops).


when the call to freq returns 0, it causes a divide by zero error in the score calculation

i solved this by taking the max of the freq result and 0.1 but i'm not sure if that's the most appropriate solution

fortable1999 commented 12 years ago

Original comment by argonaut (Bitbucket: argonaut, GitHub: argonaut).


related to issue #296

fortable1999 commented 12 years ago

Original comment by Matt Chaput (Bitbucket: mchaput, GitHub: mchaput).


Sorry for the delay in replying. If the frequency call returns 0, it's a bug, since that would indicate a mis-match between what's in the index and what's in the word graph. In the code in the repo I inserted an "assert" statement for this so at least the error message will be slightly clearer.