etianen / django-watson

Full-text multi-table search application for Django. Easy to install and use, with good performance.
BSD 3-Clause "New" or "Revised" License
1.2k stars 130 forks source link

filter not working with UUIDField #227

Closed OskarPersson closed 6 years ago

OskarPersson commented 6 years ago

watson.filter() doesn't seem to work when the primary key is a Django.UUIDField. I always get an empty result set. The data is indexed in the databse and watson.search() seems to work as expected.

I have setup a simple test project that demonstrates this here. I've tested it with Django 1.11.6 in Python 2.7.14 running on macOS with SQLite 3.19.3 and MySQL Ver 14.14 Distrib 5.7.20 (using mysqlclient 1.3.10).

>>> from books.models import Book
>>> from watson import search as watson
>>>
>>> Book.objects.create(title="My book")
<Book: Book object>
>>> watson.search('book')
<QuerySet [<SearchEntry: Book object>]>
>>> isinstance(watson.search('book')[0].object, Book)
True
>>> watson.filter(Book, 'book')
<QuerySet []>
etianen commented 6 years ago

Fixed in master. Let me know if it works for you!

OskarPersson commented 6 years ago

Works great, thanks!

etianen commented 6 years ago

Nice. I'll release next Monday.