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
91
doc/API.md
91
doc/API.md
|
@ -793,38 +793,39 @@ data.
|
|||
|
||||
**Sort style tokens**
|
||||
|
||||
| `<value>` | Description |
|
||||
| ---------------- | ------------------------------------------------ |
|
||||
| `random` | as random as it can get |
|
||||
| `id` | highest to lowest post number |
|
||||
| `score` | highest scored |
|
||||
| `tag-count` | with most tags |
|
||||
| `comment-count` | most commented first |
|
||||
| `fav-count` | loved by most |
|
||||
| `note-count` | with most annotations |
|
||||
| `relation-count` | with most relations |
|
||||
| `feature-count` | most often featured |
|
||||
| `file-size` | largest files first |
|
||||
| `image-width` | widest images first |
|
||||
| `image-height` | tallest images first |
|
||||
| `image-area` | largest images first |
|
||||
| `width` | alias of `image-width` |
|
||||
| `height` | alias of `image-height` |
|
||||
| `area` | alias of `image-area` |
|
||||
| `creation-date` | newest to oldest (pretty much same as id) |
|
||||
| `creation-time` | alias of `creation-date` |
|
||||
| `date` | alias of `creation-date` |
|
||||
| `time` | alias of `creation-date` |
|
||||
| `last-edit-date` | like creation-date, only looks at last edit time |
|
||||
| `last-edit-time` | alias of `last-edit-date` |
|
||||
| `edit-date` | alias of `last-edit-date` |
|
||||
| `edit-time` | alias of `last-edit-date` |
|
||||
| `comment-date` | recently commented by anyone |
|
||||
| `comment-time` | alias of `comment-date` |
|
||||
| `fav-date` | recently added to favorites by anyone |
|
||||
| `fav-time` | alias of `fav-date` |
|
||||
| `feature-date` | recently featured |
|
||||
| `feature-time` | alias of `feature-time` |
|
||||
| `<value>` | Description |
|
||||
| ---------------- | ------------------------------------------------ |
|
||||
| `random` | as random as it can get |
|
||||
| `id` | highest to lowest post number |
|
||||
| `score` | highest scored |
|
||||
| `tag-count` | with most tags |
|
||||
| `comment-count` | most commented first |
|
||||
| `fav-count` | loved by most |
|
||||
| `note-count` | with most annotations |
|
||||
| `relation-count` | with most relations |
|
||||
| `feature-count` | most often featured |
|
||||
| `file-size` | largest files first |
|
||||
| `image-width` | widest images first |
|
||||
| `image-height` | tallest images first |
|
||||
| `image-area` | largest images first |
|
||||
| `width` | alias of `image-width` |
|
||||
| `height` | alias of `image-height` |
|
||||
| `area` | alias of `image-area` |
|
||||
| `creation-date` | newest to oldest (pretty much same as id) |
|
||||
| `creation-time` | alias of `creation-date` |
|
||||
| `date` | alias of `creation-date` |
|
||||
| `time` | alias of `creation-date` |
|
||||
| `last-edit-date` | like creation-date, only looks at last edit time |
|
||||
| `last-edit-time` | alias of `last-edit-date` |
|
||||
| `edit-date` | alias of `last-edit-date` |
|
||||
| `edit-time` | alias of `last-edit-date` |
|
||||
| `comment-date` | recently commented by anyone |
|
||||
| `comment-time` | alias of `comment-date` |
|
||||
| `fav-date` | recently added to favorites by anyone |
|
||||
| `fav-time` | alias of `fav-date` |
|
||||
| `feature-date` | recently featured |
|
||||
| `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**
|
||||
|
||||
|
@ -1333,6 +1334,7 @@ data.
|
|||
|
||||
| `<key>` | Description |
|
||||
| ------------------- | ----------------------------------------- |
|
||||
| `id` | having given pool number |
|
||||
| `name` | having given name (accepts wildcards) |
|
||||
| `category` | having given category (accepts wildcards) |
|
||||
| `creation-date` | created at given date |
|
||||
|
@ -1345,18 +1347,19 @@ data.
|
|||
|
||||
**Sort style tokens**
|
||||
|
||||
| `<value>` | Description |
|
||||
| ------------------- | ---------------------------- |
|
||||
| `random` | as random as it can get |
|
||||
| `name` | A to Z |
|
||||
| `category` | category (A to Z) |
|
||||
| `creation-date` | recently created first |
|
||||
| `creation-time` | alias of `creation-date` |
|
||||
| `last-edit-date` | recently edited first |
|
||||
| `last-edit-time` | alias of `creation-time` |
|
||||
| `edit-date` | alias of `creation-time` |
|
||||
| `edit-time` | alias of `creation-time` |
|
||||
| `post-count` | used in most posts first |
|
||||
| `<value>` | Description |
|
||||
| ------------------- | ---------------------------- |
|
||||
| `random` | as random as it can get |
|
||||
| `id` | highest to lowest pool number |
|
||||
| `name` | A to Z |
|
||||
| `category` | category (A to Z) |
|
||||
| `creation-date` | recently created first |
|
||||
| `creation-time` | alias of `creation-date` |
|
||||
| `last-edit-date` | recently edited first |
|
||||
| `last-edit-time` | alias of `creation-time` |
|
||||
| `edit-date` | alias of `creation-time` |
|
||||
| `edit-time` | alias of `creation-time` |
|
||||
| `post-count` | used in most posts first |
|
||||
|
||||
**Special tokens**
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ class PoolSearchConfig(BaseSearchConfig):
|
|||
raise NotImplementedError()
|
||||
|
||||
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
|
||||
def anonymous_filter(self) -> Filter:
|
||||
|
@ -45,6 +45,7 @@ class PoolSearchConfig(BaseSearchConfig):
|
|||
def named_filters(self) -> Dict[str, Filter]:
|
||||
return util.unalias_dict(
|
||||
[
|
||||
(["id"], search_util.create_num_filter(model.Pool.pool_id)),
|
||||
(
|
||||
["name"],
|
||||
search_util.create_subquery_filter(
|
||||
|
@ -91,6 +92,7 @@ class PoolSearchConfig(BaseSearchConfig):
|
|||
["random"],
|
||||
(sa.sql.expression.func.random(), self.SORT_NONE),
|
||||
),
|
||||
(["id"], (model.Pool.pool_id, self.SORT_DESC)),
|
||||
(["name"], (model.Pool.first_name, self.SORT_ASC)),
|
||||
(["category"], (model.PoolCategory.name, self.SORT_ASC)),
|
||||
(
|
||||
|
|
Loading…
Reference in a new issue