You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1234567891011121314151617181920
  1. from django.conf.urls import *
  2. from haystack.query import SearchQuerySet
  3. from oscar.core.loading import import_module
  4. import_module('search.views', ['Suggestions', 'MultiFacetedSearchView'], locals())
  5. import_module('search.forms', ['MultiFacetedSearchForm'], locals())
  6. import_module('search.search_indexes', ['ProductIndex'], locals())
  7. sqs = SearchQuerySet()
  8. for field_name, field in ProductIndex.fields.items():
  9. if field.faceted is True:
  10. # Ensure we facet the results set by the defined facetable fields
  11. sqs.facet(field_name)
  12. urlpatterns = patterns('search.apps.views',
  13. url(r'^suggest/$', Suggestions.as_view(), name='oscar-search-suggest'),
  14. url(r'^$', MultiFacetedSearchView(form_class=MultiFacetedSearchForm,
  15. searchqueryset=sqs), name='oscar-search'),
  16. )