Add new sort tokens for pools; update API doc
This commit is contained in:
parent
47377395a2
commit
161a3939c9
2 changed files with 50 additions and 45 deletions
|
@ -825,6 +825,7 @@ data.
|
||||||
| `fav-time` | alias of `fav-date` |
|
| `fav-time` | alias of `fav-date` |
|
||||||
| `feature-date` | recently featured |
|
| `feature-date` | recently featured |
|
||||||
| `feature-time` | alias of `feature-time` |
|
| `feature-time` | alias of `feature-time` |
|
||||||
|
| `pool` | post order of the pool referenced by the `pool:` named token in the same search query |
|
||||||
|
|
||||||
**Special tokens**
|
**Special tokens**
|
||||||
|
|
||||||
|
@ -1333,6 +1334,7 @@ data.
|
||||||
|
|
||||||
| `<key>` | Description |
|
| `<key>` | Description |
|
||||||
| ------------------- | ----------------------------------------- |
|
| ------------------- | ----------------------------------------- |
|
||||||
|
| `id` | having given pool number |
|
||||||
| `name` | having given name (accepts wildcards) |
|
| `name` | having given name (accepts wildcards) |
|
||||||
| `category` | having given category (accepts wildcards) |
|
| `category` | having given category (accepts wildcards) |
|
||||||
| `creation-date` | created at given date |
|
| `creation-date` | created at given date |
|
||||||
|
@ -1348,6 +1350,7 @@ data.
|
||||||
| `<value>` | Description |
|
| `<value>` | Description |
|
||||||
| ------------------- | ---------------------------- |
|
| ------------------- | ---------------------------- |
|
||||||
| `random` | as random as it can get |
|
| `random` | as random as it can get |
|
||||||
|
| `id` | highest to lowest pool number |
|
||||||
| `name` | A to Z |
|
| `name` | A to Z |
|
||||||
| `category` | category (A to Z) |
|
| `category` | category (A to Z) |
|
||||||
| `creation-date` | recently created first |
|
| `creation-date` | recently created first |
|
||||||
|
|
|
@ -30,7 +30,7 @@ class PoolSearchConfig(BaseSearchConfig):
|
||||||
raise NotImplementedError()
|
raise NotImplementedError()
|
||||||
|
|
||||||
def finalize_query(self, query: SaQuery) -> SaQuery:
|
def finalize_query(self, query: SaQuery) -> SaQuery:
|
||||||
return query.order_by(model.Pool.first_name.asc())
|
return query.order_by(model.Pool.pool_id.desc())
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def anonymous_filter(self) -> Filter:
|
def anonymous_filter(self) -> Filter:
|
||||||
|
@ -45,6 +45,7 @@ class PoolSearchConfig(BaseSearchConfig):
|
||||||
def named_filters(self) -> Dict[str, Filter]:
|
def named_filters(self) -> Dict[str, Filter]:
|
||||||
return util.unalias_dict(
|
return util.unalias_dict(
|
||||||
[
|
[
|
||||||
|
(["id"], search_util.create_num_filter(model.Pool.pool_id)),
|
||||||
(
|
(
|
||||||
["name"],
|
["name"],
|
||||||
search_util.create_subquery_filter(
|
search_util.create_subquery_filter(
|
||||||
|
@ -91,6 +92,7 @@ class PoolSearchConfig(BaseSearchConfig):
|
||||||
["random"],
|
["random"],
|
||||||
(sa.sql.expression.func.random(), self.SORT_NONE),
|
(sa.sql.expression.func.random(), self.SORT_NONE),
|
||||||
),
|
),
|
||||||
|
(["id"], (model.Pool.pool_id, self.SORT_DESC)),
|
||||||
(["name"], (model.Pool.first_name, self.SORT_ASC)),
|
(["name"], (model.Pool.first_name, self.SORT_ASC)),
|
||||||
(["category"], (model.PoolCategory.name, self.SORT_ASC)),
|
(["category"], (model.PoolCategory.name, self.SORT_ASC)),
|
||||||
(
|
(
|
||||||
|
|
Loading…
Reference in a new issue