-
Notifications
You must be signed in to change notification settings - Fork 14
Sorting
dbuthay edited this page Aug 12, 2011
·
1 revision
- an Indextank_[Ize]'d FORM.
- an Indextank_[AjaxSearch]'d INPUT to listen to.
- import jquery.indextank.sorting.js
Sorting binds to an element to display sorting controls for the results of an AjaxSearch. It allows to re-run the last query with a modified scoringFunction, when a label is clicked.
var s = $("#sorting").indextank_Sorting({labels: {"relevance": 0, "newest": "1"}});
$("#query").indextank_AjaxSearch({listeners: s});
- labels: an Object with function names as keys and integers as values. In the example above, relevance is the function 0, and newest is the function 1. Make sure the names match the semantics for the functions defined for your index.
-
Reacts to
- Indextank.AjaxSearch.success: Keeps track of the latest query, to re-run it with a modified scoringFunction if needed.
-
Triggers
- Indextank.AjaxSearch.runQuery: When a label is clicked, it clones the last query, changes the scoringFunction and re-runs it.