Procházet zdrojové kódy

Merge pull request #2150 from vaskinyy/facet-sorting-docs

- added documentation for facet sorting
master
Alexander Gaevsky před 8 roky
rodič
revize
34ed8709ef
2 změnil soubory, kde provedl 7 přidání a 2 odebrání
  1. 3
    1
      docs/source/ref/settings.rst
  2. 4
    1
      src/oscar/defaults.py

+ 3
- 1
docs/source/ref/settings.rst Zobrazit soubor

@@ -94,7 +94,9 @@ all default to 20.
94 94
 
95 95
 A dictionary that specifies the facets to use with the search backend.  It
96 96
 needs to be a dict with keys ``fields`` and ``queries`` for field- and
97
-query-type facets.  The default is::
97
+query-type facets. Field-type facets can get an 'options' element with parameters like facet
98
+sorting, filtering, etc.
99
+The default is::
98 100
 
99 101
     OSCAR_SEARCH_FACETS = {
100 102
         'fields': OrderedDict([

+ 4
- 1
src/oscar/defaults.py Zobrazit soubor

@@ -224,7 +224,10 @@ OSCAR_SEARCH_FACETS = {
224 224
         ('product_class', {'name': _('Type'), 'field': 'product_class'}),
225 225
         ('rating', {'name': _('Rating'), 'field': 'rating'}),
226 226
         # You can specify an 'options' element that will be passed to the
227
-        # SearchQuerySet.facet() call.  It's hard to get 'missing' to work
227
+        # SearchQuerySet.facet() call.
228
+        # For instance, with Elasticsearch backend, 'options': {'order': 'term'}
229
+        # will sort items in a facet by title instead of number of items.
230
+        # It's hard to get 'missing' to work
228 231
         # correctly though as of Solr's hilarious syntax for selecting
229 232
         # items without a specific facet:
230 233
         # http://wiki.apache.org/solr/SimpleFacetParameters#facet.method

Načítá se…
Zrušit
Uložit