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 = [ var table = [
{search: 'order:random', description: 'as random as it can get'}, {search: 'order:random', description: 'as random as it can get'},
{search: 'order:id', description: 'highest to lowest post ID (default browse view)'}, {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:creation_date', description: 'newest to oldest (pretty much same as above)'},
{search: '-order:edit_date', description: 'oldest to newest'}, {search: '-order:creation_date', description: 'oldest to newest'},
{search: 'order:edit_date,asc', description: 'oldest to newest (ascending order, default = descending)'}, {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:score', description: 'highest scored'},
{search: 'order:file_size', description: 'largest files first'}, {search: 'order:file_size', description: 'largest files first'},
{search: 'order:tag_count', description: 'with most tags'}, {search: 'order:tag_count', description: 'with most tags'},
@ -188,7 +189,7 @@
</table> </table>
<p>As shown with <a <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 any of them can be reversed in the same way as negating other tags: by
placing a dash before the tag.</p> placing a dash before the tag.</p>
</div> </div>

View file

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

View file

@ -119,6 +119,7 @@ class PostSearchParser extends AbstractSearchParser
[ [
[['id'], PostFilter::ORDER_ID], [['id'], PostFilter::ORDER_ID],
[['random'], PostFilter::ORDER_RANDOM], [['random'], PostFilter::ORDER_RANDOM],
[['creation_time', 'creation_date', 'date'], PostFilter::ORDER_CREATION_TIME],
[['edit_time', 'edit_date'], PostFilter::ORDER_LAST_EDIT_TIME], [['edit_time', 'edit_date'], PostFilter::ORDER_LAST_EDIT_TIME],
[['score'], PostFilter::ORDER_SCORE], [['score'], PostFilter::ORDER_SCORE],
[['file_size'], PostFilter::ORDER_FILE_SIZE], [['file_size'], PostFilter::ORDER_FILE_SIZE],

View file

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