Added support to search for posts by creation time

This commit is contained in:
rr- 2015-11-24 18:08:49 +01:00
parent b7456463eb
commit 40e869b848
4 changed files with 24 additions and 21 deletions

View file

@ -165,9 +165,10 @@
var table = [
{search: 'order:random', description: 'as random as it can get'},
{search: 'order:id', description: 'highest to lowest post ID (default browse view)'},
{search: 'order:edit_date', description: 'newest to oldest (pretty much same as above)'},
{search: '-order:edit_date', description: 'oldest to newest'},
{search: 'order:edit_date,asc', description: 'oldest to newest (ascending order, default = descending)'},
{search: 'order:creation_date', description: 'newest to oldest (pretty much same as above)'},
{search: '-order:creation_date', description: 'oldest to newest'},
{search: 'order:creation_date,asc', description: 'oldest to newest (ascending order, default = descending)'},
{search: 'order:edit_date', description: 'like <code>creation_date</code>, only looks at last edit time'},
{search: 'order:score', description: 'highest scored'},
{search: 'order:file_size', description: 'largest files first'},
{search: 'order:tag_count', description: 'with most tags'},
@ -188,7 +189,7 @@
</table>
<p>As shown with <a
href="#/posts/query=-order:edit_date"><code>-order:edit_date</code></a>,
href="#/posts/query=-order:creation_date"><code>-order:creation_date</code></a>,
any of them can be reversed in the same way as negating other tags: by
placing a dash before the tag.</p>
</div>

View file

@ -9,6 +9,7 @@ class PostFilter extends BasicFilter implements IFilter
const ORDER_COMMENT_COUNT = 'commentCount';
const ORDER_NOTE_COUNT = 'noteCount';
const ORDER_SCORE = 'score';
const ORDER_CREATION_TIME = 'creationTime';
const ORDER_LAST_EDIT_TIME = 'lastEditTime';
const ORDER_FILE_SIZE = 'originalFileSize';
const ORDER_LAST_COMMENT_TIME = 'lastCommentCreationTime';

View file

@ -117,19 +117,20 @@ class PostSearchParser extends AbstractSearchParser
{
return
[
[['id'], PostFilter::ORDER_ID],
[['random'], PostFilter::ORDER_RANDOM],
[['edit_time', 'edit_date'], PostFilter::ORDER_LAST_EDIT_TIME],
[['score'], PostFilter::ORDER_SCORE],
[['file_size'], PostFilter::ORDER_FILE_SIZE],
[['tag_count', 'tags', 'tag'], PostFilter::ORDER_TAG_COUNT],
[['fav_count', 'fags', 'fav'], PostFilter::ORDER_FAV_COUNT],
[['comment_count', 'comments', 'comment'], PostFilter::ORDER_COMMENT_COUNT],
[['note_count', 'notes', 'note'], PostFilter::ORDER_NOTE_COUNT],
[['fav_time', 'fav_date'], PostFilter::ORDER_LAST_FAV_TIME],
[['comment_time', 'comment_date'], PostFilter::ORDER_LAST_COMMENT_TIME],
[['feature_time', 'feature_date'], PostFilter::ORDER_LAST_FEATURE_TIME],
[['feature_count', 'features', 'featured'], PostFilter::ORDER_FEATURE_COUNT],
[['id'], PostFilter::ORDER_ID],
[['random'], PostFilter::ORDER_RANDOM],
[['creation_time', 'creation_date', 'date'], PostFilter::ORDER_CREATION_TIME],
[['edit_time', 'edit_date'], PostFilter::ORDER_LAST_EDIT_TIME],
[['score'], PostFilter::ORDER_SCORE],
[['file_size'], PostFilter::ORDER_FILE_SIZE],
[['tag_count', 'tags', 'tag'], PostFilter::ORDER_TAG_COUNT],
[['fav_count', 'fags', 'fav'], PostFilter::ORDER_FAV_COUNT],
[['comment_count', 'comments', 'comment'], PostFilter::ORDER_COMMENT_COUNT],
[['note_count', 'notes', 'note'], PostFilter::ORDER_NOTE_COUNT],
[['fav_time', 'fav_date'], PostFilter::ORDER_LAST_FAV_TIME],
[['comment_time', 'comment_date'], PostFilter::ORDER_LAST_COMMENT_TIME],
[['feature_time', 'feature_date'], PostFilter::ORDER_LAST_FEATURE_TIME],
[['feature_count', 'features', 'featured'], PostFilter::ORDER_FEATURE_COUNT],
];
}

View file

@ -42,10 +42,10 @@ class TagSearchParser extends AbstractSearchParser
{
return
[
[['id'], TagFilter::ORDER_ID],
[['name'], TagFilter::ORDER_NAME],
[['creation_time', 'creation_date'], TagFilter::ORDER_CREATION_TIME],
[['usage_count', 'usages'], TagFilter::ORDER_USAGE_COUNT],
[['id'], TagFilter::ORDER_ID],
[['name'], TagFilter::ORDER_NAME],
[['creation_time', 'creation_date', 'date'], TagFilter::ORDER_CREATION_TIME],
[['usage_count', 'usages'], TagFilter::ORDER_USAGE_COUNT],
];
}
}