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 129 forks source link

'QuerySet' object has no attribute 'strip' #295

Closed massoudrahimzadeh closed 2 years ago

massoudrahimzadeh commented 2 years ago

Hello and thank you for the nice package, I am receiving the following error: 'QuerySet' object has no attribute 'strip'

here s the piece of code: `def get_queryset(self): queryset = Contributor.objects.all() q = self.request.query_params.get('q') print(q) if q: queryset = queryset.filter(program_name=q) new_qs = watson.search(queryset, q) return new_qs

    return queryset

` I use django-watson in django rest framework project to improve the search functionality and finding the similar results. I appreciate if you can have a look and help me out.

Warm Regards Massoud

massoudrahimzadeh commented 2 years ago

watson.search(queryset, q) is a wrong format for search, changing it to watson.filter(queryset, q) resolved it