1
0
mirror of https://github.com/flarum/core.git synced 2025-10-14 16:34:26 +02:00

Fix relevance sort (#2773)

- Adds a field to QueryCriteria that determines whether the sort provided is the controller's default sort
- Set this field to true iff sort not in query params. Default it to false
- Override $sort if a new default sort has been set on search state, and the param is true.
- Add tests!
This commit is contained in:
Alexander Skvortsov
2021-04-11 22:21:56 -04:00
committed by GitHub
parent 548f1321f1
commit b6f0b01307
9 changed files with 42 additions and 17 deletions

View File

@@ -65,7 +65,7 @@ abstract class AbstractFilterer
}
}
$this->applySort($filterState, $criteria->sort);
$this->applySort($filterState, $criteria->sort, $criteria->sortIsDefault);
$this->applyOffset($filterState, $offset);
$this->applyLimit($filterState, $limit + 1);