Skip to content

Commit

Permalink
feat(connectors): sortBy to ['isRefined', 'count:desc']
Browse files Browse the repository at this point in the history
  • Loading branch information
iam4x committed Mar 27, 2017
1 parent 6ccec3d commit 01219f1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/connectors/hierarchical-menu/connectHierarchicalMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ search.addWidget(
[ rootPath = null ],
[ showParentLevel = true ],
[ limit = 10 ],
[ sortBy = ['name:asc'] ],
[ sortBy = ['isRefined', 'count:desc'] ],
});
);
Full documentation available at https://community.algolia.com/instantsearch.js/connectors/connectHierarchicalMenu.html
Expand All @@ -29,7 +29,7 @@ Full documentation available at https://community.algolia.com/instantsearch.js/c
* @param {string} [rootPath] Prefix path to use if the first level is not the root level.
* @param {string} [showParentLevel=false] Show the parent level of the current refined value
* @param {number} [limit=10] How much facet values to get [*]
* @param {string[]|Function} [sortBy=['name:asc']] How to sort refinements. Possible values: `count|isRefined|name:asc|name:desc`.
* @param {string[]|Function} [sortBy=['isRefined', 'count:desc']] How to sort refinements. Possible values: `count|isRefined|name:asc|name:desc`.
* You can also use a sort function that behaves like the standard Javascript [compareFunction](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#Syntax).
*/

Expand Down Expand Up @@ -57,7 +57,7 @@ export default function connectHierarchicalMenu(renderFn) {
rootPath = null,
showParentLevel = true,
limit = 10,
sortBy = ['name:asc'],
sortBy = ['isRefined', 'count:desc'],
} = widgetParams;

if (!attributes || !attributes.length) {
Expand Down
6 changes: 3 additions & 3 deletions src/connectors/menu/connectMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ search.addWidget(
customMenu({
attributeName,
[ limit ],
[ sortBy = ['count:desc', 'name:asc'] ]
[ sortBy = ['isRefined', 'count:desc'] ]
});
);
Full documentation available at https://community.algolia.com/instantsearch.js/connectors/connectMenu.html
Expand All @@ -26,7 +26,7 @@ Full documentation available at https://community.algolia.com/instantsearch.js/c
* @typedef {Object} CustomMenuWidgetOptions
* @param {string} attributeName Name of the attribute for faceting (eg. "free_shipping")
* @param {number} [limit = 10] How many facets values to retrieve [*]
* @param {string[]|function} [sortBy = ['count:desc', 'name:asc']] How to sort refinements. Possible values: `count|isRefined|name:asc|name:desc`.
* @param {string[]|function} [sortBy = ['isRefined', 'count:desc']] How to sort refinements. Possible values: `count|isRefined|name:asc|name:desc`.
* You can also use a sort function that behaves like the standard Javascript [compareFunction](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#Syntax). [*]
*/

Expand All @@ -52,7 +52,7 @@ export default function connectMenu(renderFn) {
const {
attributeName,
limit = 10,
sortBy = ['count:desc', 'name:asc'],
sortBy = ['isRefined', 'count:desc'],
} = widgetParams;

if (!attributeName) {
Expand Down
6 changes: 3 additions & 3 deletions src/connectors/refinement-list/connectRefinementList.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ search.addWidget(
attributeName,
[ operator = 'or' ],
[ limit ],
[ sortBy = ['count:desc', 'name:asc'] ]
[ sortBy = ['isRefined', 'count:desc'] ]
});
);
Full documentation available at https://community.algolia.com/instantsearch.js/connectors/connectRefinementList.html
Expand All @@ -38,7 +38,7 @@ export const checkUsage = ({attributeName, operator, usageMessage}) => {
* @property {string} attributeName the attribute in the records that are used by the widget
* @property {string} operator how the filters are combined together
* @property {number} limit the max number of items displayed
* @property {string[]} sortBy how the values are ordered
* @param {string[]|function} [sortBy = ['isRefined', 'count:desc']] How to sort refinements. Possible values: `count|isRefined|name:asc|name:desc`.
*/

/**
Expand Down Expand Up @@ -68,7 +68,7 @@ export default function connectRefinementList(renderFn) {
attributeName,
operator = 'or',
limit,
sortBy = ['count:desc', 'name:asc'],
sortBy = ['isRefined', 'count:desc'],
} = widgetParams;

checkUsage({attributeName, operator, usage});
Expand Down

0 comments on commit 01219f1

Please sign in to comment.