experimental patch to query.py for better term length parsing