You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a user typo's a numeric field in their query:
File "C:\Users\Chris\AppData\Local\Python\venv\document-search\Lib\site-packages\whoosh\searching.py", line 931, in correct_query
return sqc.correct_query(q, qstring)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Chris\AppData\Local\Python\venv\document-search\Lib\site-packages\whoosh\spelling.py", line 327, in correct_query
sugs = c.suggest(token.text, prefix=prefix, maxdist=maxdist)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Chris\AppData\Local\Python\venv\document-search\Lib\site-packages\whoosh\spelling.py", line 66, in suggest
for item in _suggestions(text, maxdist, prefix):
File "C:\Users\Chris\AppData\Local\Python\venv\document-search\Lib\site-packages\whoosh\spelling.py", line 111, in _suggestions
for sug in reader.terms_within(sugfield, text, maxdist, prefix=prefix):
File "C:\Users\Chris\AppData\Local\Python\venv\document-search\Lib\site-packages\whoosh\codec\base.py", line 364, in find_matches
match = dfa.next_valid_string(term)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Chris\AppData\Local\Python\venv\document-search\Lib\site-packages\whoosh\automata\fsa.py", line 267, in next_valid_string
for i, label in enumerate(string):
^^^^^^^^^^^^^^^^^
TypeError: 'int' object is not iterable
This doesn't seem right. We're using ReaderCorrector as the default for all fields? SegmentReader.terms_within() uses Automata.terms_within() which is Levenshtein distance:
# Fill in default corrector objects for fields that don't have a custom# one in the "correctors" dictionaryfromwhoosh.fieldsimportTEXT# <-----forfieldname, fieldinself.schema.items(): # <-----fieldname=aliases.get(fieldname, fieldname)
ifisinstance(field, TEXT) andfieldnamenotincorrectors: # <-----correctors[fieldname] =self.reader().corrector(fieldname)
Anyway that's the fix I'm using for now. I only need corrections for text fields.
The text was updated successfully, but these errors were encountered:
When a user typo's a numeric field in their query:
If we look here:
whoosh/src/whoosh/searching.py
Line 914 in d9a3fa2
This doesn't seem right. We're using
ReaderCorrector
as the default for all fields?SegmentReader.terms_within()
usesAutomata.terms_within()
which is Levenshtein distance:whoosh/src/whoosh/codec/base.py
Line 376 in d9a3fa2
NUMERIC.from_bytes()
received withinW3FieldCursor
:whoosh/src/whoosh/codec/whoosh3.py
Line 541 in d9a3fa2
Pretty sure Levenshtein distance isn't meant to be supported on NUMERIC fields? Since they're stored like
whoosh/src/whoosh/fields.py
Line 712 in d9a3fa2
Shouldn't
searching.py
be something more like:Anyway that's the fix I'm using for now. I only need corrections for text fields.
The text was updated successfully, but these errors were encountered: