xapian-haystack icon indicating copy to clipboard operation
xapian-haystack copied to clipboard

Must not assume django_id is an int

Open linkmic opened this issue 10 years ago • 1 comments

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

linkmic avatar Nov 26 '14 18:11 linkmic

You are correct. We are assuming ints. I don't see any issue in extending it to non-integers.

jorgecarleitao avatar Jan 12 '15 18:01 jorgecarleitao