from __future__ import unicode_literals

from django import forms
from django.utils.translation import pgettext
from .backends import elasticsearch


class SearchForm(forms.Form):
    q = forms.CharField(
        label=pgettext('Search form label', 'Query'), required=True)

    def search(self):
        return elasticsearch.search(self.cleaned_data['q'])

from __future__ import unicode_literals

from django import forms
from django.utils.translation import pgettext
from .backends import picker


class SearchForm(forms.Form):
    q = forms.CharField(
        label=pgettext('Search form label', 'Query'), required=True)

    def search(self):
        search = picker.pick_backend()
        return search(self.cleaned_data['q'])

Use backend picker in storefront search form
Use backend picker in storefront search form
