xapian-haystack
xapian-haystack copied to clipboard
Must not assume django_id is an int
Hi,
In xapian_backend.py it is not safe to assume that django_id is an int. In my application, for example, I use django-uuidfield and the id (pk) of the objects cannot be cast to integer.
from xapian_backend.py
if field['field_name'] in ('id', 'django_id', 'django_ct'):
# Private fields are indexed in a different way:
# django_id
is an int and django_ct
is text;
# besides, they are indexed by their (unstemmed) value.
if field['field_name'] == 'django_id':
value = int(value)
value = _term_to_xapian_value(value, field['type'])
Do you have any suggestion how I could resolve this? Thanks, /mike
You are correct. We are assuming ints. I don't see any issue in extending it to non-integers.