Skip to content

Commit

Permalink
Merge pull request #1 from Alir3z4/Alir3z4-fix-pk-when-as-str
Browse files Browse the repository at this point in the history
Fix to accept string based primary keys
  • Loading branch information
Alir3z4 committed Nov 10, 2015
2 parents 6756b68 + 545c4a2 commit b7a1390
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions xapian_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -429,8 +429,9 @@ def add_datetime_to_document(termpos, prefix, term, weight):
# `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'])
value = str(value)
value = _term_to_xapian_value(value, 'text')


document.add_term(TERM_PREFIXES[field['field_name']] + value, weight)
document.add_value(field['column'], value)
Expand Down

0 comments on commit b7a1390

Please sign in to comment.