xapian_haystack (3.0.1) has this exception:
Traceback (most recent call last):
File "/home/pooh/venv/lib/python3.10/site-packages/django/core/handlers/exception.py", line 47, in inner
response = get_response(request)
File "/home/pooh/venv/lib/python3.10/site-packages/django/core/handlers/base.py", line 181, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/pooh/venv/lib/python3.10/site-packages/haystack/views.py", line 161, in search_view
return view_class(*args, **kwargs)(request)
File "/home/pooh/venv/lib/python3.10/site-packages/oscar/apps/search/views.py", line 25, in __call__
response = super().__call__(request)
File "/home/pooh/venv/lib/python3.10/site-packages/haystack/views.py", line 52, in __call__
self.results = self.get_results()
File "/home/pooh/venv/lib/python3.10/site-packages/oscar/apps/search/views.py", line 68, in get_results
return super().get_results().models(Product)
File "/home/pooh/venv/lib/python3.10/site-packages/haystack/views.py", line 90, in get_results
return self.form.search()
File "/home/pooh/metagrocery/oscar_forks/search/forms.py", line 61, in search
vals_range=get_vals(sqs_range)
File "/home/pooh/metagrocery/oscar_forks/search/forms.py", line 45, in get_vals
for _1 in sorted(filter(None, (_.sugar for _ in s)))
File "/home/pooh/metagrocery/oscar_forks/search/forms.py", line 45, in <genexpr>
for _1 in sorted(filter(None, (_.sugar for _ in s)))
File "/home/pooh/venv/lib/python3.10/site-packages/haystack/query.py", line 150, in _manual_iter
if not self._fill_cache(
File "/home/pooh/venv/lib/python3.10/site-packages/haystack/query.py", line 231, in _fill_cache
results = self.query.get_results(**kwargs)
File "/home/pooh/venv/lib/python3.10/site-packages/haystack/backends/__init__.py", line 677, in get_results
self.run(**kwargs)
File "/home/pooh/venv/lib/python3.10/site-packages/haystack/backends/__init__.py", line 587, in run
final_query = self.build_query()
File "/home/pooh/venv/lib/python3.10/site-packages/xapian_backend.py", line 1261, in build_query
query = self._query_from_search_node(self.query_filter)
File "/home/pooh/venv/lib/python3.10/site-packages/xapian_backend.py", line 1302, in _query_from_search_node
constructed_query_list = self._query_from_term(term, field_name, filter_type, is_not)
File "/home/pooh/venv/lib/python3.10/site-packages/xapian_backend.py", line 1388, in _query_from_term
query_list.append(self._filter_range(term, field_name, field_type, is_not))
File "/home/pooh/venv/lib/python3.10/site-packages/xapian_backend.py", line 1581, in _filter_range
pos, begin, end = vrp('%s:%s' % (field_name, _term_to_xapian_value(term[0], field_type)),
File "/home/pooh/venv/lib/python3.10/site-packages/xapian_backend.py", line 148, in __call__
begin = _term_to_xapian_value(float(begin), field_type)
ValueError: could not convert string to float: "b'\\xb1'"
I'm not sure about the logic there, but I see we first convert float in _filter_range (and family), probably to pass it in a "field_name:term" notation to the range filter. And then once again in the filter, where it breaks.
To move forward, I've changed the _filter functions along these lines:
Then rangefilter gets the data as strings, parses it in a usual way, converts to internal representation suitable for xapian bindings only once. Seems to work for my needs, maybe it will save some time for someone with the same setup, until (unless) it'll be fixed by the devs.