Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/plugins/kibana/public/discover/controllers/discover.js
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@ define(function (require) {
*/
var sortBy = (function () {
if (!_.isArray(sort)) return 'implicit';
else if (sort[0] === '_score') return 'implicit';
else if (sort[0] === timeField) return 'time';
else return 'non-time';
}());
Expand All @@ -333,6 +334,7 @@ define(function (require) {
}

$scope.updateTime();
if (sort[0] === '_score') segmented.setMaxSegments(1);
segmented.setDirection(sortBy === 'time' ? (sort[1] || 'desc') : 'desc');
segmented.setSize(sortBy === 'time' ? $scope.opts.sampleSize : false);

Expand Down
1 change: 1 addition & 0 deletions src/ui/public/courier/fetch/request/_segmented_handle.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ define(function (require) {
// export a couple methods from the request
this.setDirection = _.bindKey(req, 'setDirection');
this.setSize = _.bindKey(req, 'setSize');
this.setMaxSegments = _.bindKey(req, 'setMaxSegments');
}

return SegmentedHandle;
Expand Down
9 changes: 9 additions & 0 deletions src/ui/public/courier/fetch/request/segmented.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,15 @@ define(function (require) {
** SegmentedReq specific methods
*********/

/**
* Set the sort total number of segments to emit
*
* @param {number}
*/
SegmentedReq.prototype.setMaxSegments = function (maxSegments) {
this._maxSegments = Math.max(_.parseInt(maxSegments), 1);
};

/**
* Set the sort direction for the request.
*
Expand Down
4 changes: 2 additions & 2 deletions src/ui/public/doc_table/doc_table.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
sorting="sorting">
</thead>
<tbody>
<tr ng-repeat="row in page|limitTo:limit track by row._index+row._type+row._id"
<tr ng-repeat="row in page|limitTo:limit track by row._index+row._type+row._id+row._score"
kbn-table-row="row"
columns="columns"
sorting="sorting"
Expand All @@ -30,7 +30,7 @@
sorting="sorting">
</thead>
<tbody>
<tr ng-repeat="row in hits|limitTo:limit track by row._index+row._type+row._id"
<tr ng-repeat="row in hits|limitTo:limit track by row._index+row._type+row._id+row._score"
kbn-table-row="row"
columns="columns"
sorting="sorting"
Expand Down