title: TypeError at /search/ search() missing 1 required positional argument: 'request'
body: <p>I'm trying to add search filters for my <code>django-taggit</code> tags in my Django project but I keep getting a <code>TypeError</code>.</p>
  
  <p>I'm using Django-Haystack and Elasticsearch for the search functionalities, and this time I'm trying to add the filter with haystack Facets.</p>
  
  <p>Full output:</p>
  
  <pre><code>Internal Server Error: /search/
  Traceback (most recent call last):
    File "C:\Users\loicq\desktop\coding\uvergo_search\venv\lib\site-packages\django\core\handlers\exception.py", line 39, in inner
      response = get_response(request)
    File "C:\Users\loicq\desktop\coding\uvergo_search\venv\lib\site-packages\django\core\handlers\base.py", line 187, in _get_response
      response = self.process_exception_by_middleware(e, request)
    File "C:\Users\loicq\desktop\coding\uvergo_search\venv\lib\site-packages\django\core\handlers\base.py", line 185, in _get_response
      response = wrapped_callback(request, *callback_args, **callback_kwargs)
    File "C:\Users\loicq\desktop\coding\uvergo_search\venv\lib\site-packages\django\views\generic\base.py", line 68, in view
      return self.dispatch(request, *args, **kwargs)
    File "C:\Users\loicq\desktop\coding\uvergo_search\venv\lib\site-packages\django\views\generic\base.py", line 88, in dispatch
      return handler(request, *args, **kwargs)
    File "C:\Users\loicq\desktop\coding\uvergo_search\venv\lib\site-packages\haystack\generic_views.py", line 123, in get
      return self.form_valid(form)
    File "C:\Users\loicq\desktop\coding\uvergo_search\venv\lib\site-packages\haystack\generic_views.py", line 76, in form_valid
      self.queryset = form.search()
  TypeError: search() missing 1 required positional argument: 'request'
  [02/May/2019 15:29:31] "GET /search/?q=las+vegas&amp;Ptags=Solo HTTP/1.1" 500 82872
  </code></pre>
  
  <p>My models:</p>
  
  <pre><code>class Product(models.Model):
      title = models.CharField(max_length=255, default='')
      slug = models.SlugField(null=True, blank=True, unique=True, max_length=255, default='')
      description = models.TextField(default='')
  
      ptags = TaggableManager()
  
      image = models.ImageField(default='')
      timestamp = models.DateTimeField(auto_now=True)
  
      def _ptags(self):
          return [t.name for t in self.ptags.all()]
  
      def get_absolute_url(self):
          return reverse('product',
                         kwargs={'slug': self.slug})
  
  
      def __str__(self):
          return self.title
  </code></pre>
  
  <p>My custom <code>forms.py</code>:</p>
  
  <pre><code>from haystack.forms import FacetedSearchForm
  from django.db.models.query import QuerySet
  
  
  class FacetedProductSearchForm(FacetedSearchForm):
  
      def __init__(self, *args, **kwargs):
          data = dict(kwargs.get("data", []))
          super(FacetedProductSearchForm, self).__init__(*args, **kwargs)
  
      def search(self, request):
          sqs = super(FacetedProductSearchForm, self).search()
  
          ptags = request.query_params.get('ptags', None)
  
          if ptags:
              ptags = ptags.split(',')
              sqs = queryset.filter(ptags__name__in=ptags).distinct()
  
          return sqs
  </code></pre>
  
  <p>And I'm passing the function from the <code>forms.py</code> to the views like this:</p>
  
  <pre><code>class FacetedSearchView(BaseFacetedSearchView):
  
      form_class = FacetedProductSearchForm
      facet_fields = ['ptags']
      template_name = 'search_result.html'
      paginate_by = 6
      context_object_name = 'object_list'
  </code></pre>
  
  <pre><code>from django.conf.urls import url
  from django.contrib import admin
  from search.views import HomeView, ProductView, FacetedSearchView, autocomplete
  from .settings import MEDIA_ROOT, MEDIA_URL
  from django.conf.urls.static import static
  
  urlpatterns = [
      url(r'^$', HomeView.as_view()),
      url(r'^admin/', admin.site.urls),
      url(r'^product/(?P&lt;slug&gt;[\w-]+)/$', ProductView.as_view(), name='product'),
      url(r'^search/autocomplete/$', autocomplete),
      url(r'^search/', FacetedSearchView.as_view(), name='haystack_search'),
  
  ] + static(MEDIA_URL, document_root=MEDIA_ROOT)
  </code></pre>