<h1>General search syntax</h1>

<p>Search queries are built of tokens that are separated by spaces. Each token
can be of following form:</p>

<table>
    <thead>
        <tr>
            <th>Syntax</th>
            <th>Token type</th>
            <th>Description</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td><code>&lt;value&gt;</code></td>
            <td>anonymous tokens</td>
            <td>basic filters</td>
        </tr>
        <tr>
            <td><code>&lt;key&gt;:&lt;value&gt;</code></td>
            <td>named tokens</td>
            <td>advanced filters</td>
        </tr>
        <tr>
            <td><code>order:&lt;style&gt;</code></td>
            <td>order tokens</td>
            <td>sort results</td>
        </tr>
        <tr>
            <td><code>special:&lt;value&gt;</code></td>
            <td>special tokens</td>
            <td>filters usually tied to the logged in user</td>
        </tr>
    </tbody>
</table>

<p>Most of anonymous and named tokens support ranged and composite values that
take following form:</p>

<table>
    <tbody>
        <tr>
            <td><code>a,b,c</code></td>
            <td>will show things that satisfy either <code>a</code>,
            <code>b</code> or <code>c</code>.</td>
        </tr>
        <tr>
            <td><code>1..</code></td>
            <td>will show things that are equal to or greater than 1.</td>
        </tr>
        <tr>
            <td><code>..4</code></td>
            <td>will show things that are equal to at most 4.</td>
        </tr>
        <tr>
            <td><code>1..4</code></td>
            <td>will show things that are equal to 1, 2, 3 or 4.</td>
        </tr>
    </tbody>
</table>

<p>Date/time values can be of following form:</p>

<ul>
    <li><code>today</code></li>
    <li><code>yesterday</code></li>
    <li><code>&lt;year&gt;</code></li>
    <li><code>&lt;year&gt;-&lt;month&gt;</code></li>
    <li><code>&lt;year&gt;-&lt;month&gt;-&lt;day&gt;</code></li>
</ul>

<p>Some fields, such as user names, can take wildcards (<code>*</code>).</p>

<p>All tokens can be negated by prepending them with <code>-</code>.</p>

<p>Order token values can be appended with <code>,asc</code> or
<code>,desc</code> to control the sort direction, which can be also controlled
by negating the whole token.</p>

<h1>Example</h1>

<p>Searching for posts with following query:</p>

<pre><code>sea -fav-count:8.. type:swf uploader:Pirate</code></pre>

<p>will show flash files tagged as sea, that were liked by seven people at
most, uploaded by user Pirate.</p>

<h1 id='post-search-help'>Post search tokens</h1>

<p><strong>Anonymous tokens</strong></p>

<p>Filter posts tagged with given <code>&lt;value&gt;</code>.</p>

<p><strong>Named tokens</strong></p>

<table>
    <tbody>
        <tr>
            <td><code>id</code></td>
            <td>having specific post ID</td>
        </tr>
        <tr>
            <td><code>score</code></td>
            <td>having given score</td>
        </tr>
        <tr>
            <td><code>uploader</code></td>
            <td>uploaded by given user</td>
        </tr>
        <tr>
            <td><code>comment</code></td>
            <td>commented by given user</td>
        </tr>
        <tr>
            <td><code>fav</code></td>
            <td>favorited by given user</td>
        </tr>
        <tr>
            <td><code>fav-count</code></td>
            <td>favorited by given number of users</td>
        </tr>
        <tr>
            <td><code>comment-count</code></td>
            <td>having given number of comments</td>
        </tr>
        <tr>
            <td><code>tag-count</code></td>
            <td>having given number of tags</td>
        </tr>
        <tr>
            <td><code>note-count</code></td>
            <td>having given number of annotations</td>
        </tr>
        <tr>
            <td><code>feature-count</code></td>
            <td>having been featured given number of times</td>
        </tr>
        <tr>
            <td><code>date</code></td>
            <td>posted at given date</td>
        </tr>
        <tr>
            <td><code>file-size</code></td>
            <td>having given file size (in bytes)</td>
        </tr>
        <tr>
            <td><code>image-width</code></td>
            <td>having given image width (where applicable)</td>
        </tr>
        <tr>
            <td><code>image-height</code></td>
            <td>having given image height (where applicable)</td>
        </tr>
        <tr>
            <td><code>image-area</code></td>
            <td>having given number of pixels (image width * image height)</td>
        </tr>
        <tr>
            <td><code>type</code></td>
            <td>given type of posts (<code>&lt;value&gt;</code> can be either <code>image</code>, <code>flash</code>/<code>swf</code>, <code>youtube</code>/<code>yt</code>, <code>video</code> or <code>animation</code>)</td>
        </tr>
    </tbody>
</table>

<p><strong>Order tokens</strong></p>

<table>
    <tbody>
        <tr>
            <td><code>random</code></td>
            <td>as random as it can get</td>
        </tr>
        <tr>
            <td><code>id</code></td>
            <td>highest to lowest post ID</td>
        </tr>
        <tr>
            <td><code>score</code></td>
            <td>highest scored</td>
        </tr>
        <tr>
            <td><code>fav-count</code></td>
            <td>loved by most</td>
        </tr>
        <tr>
            <td><code>comment-count</code></td>
            <td>most commented first</td>
        </tr>
        <tr>
            <td><code>tag-count</code></td>
            <td>with most tags</td>
        </tr>
        <tr>
            <td><code>note-count</code></td>
            <td>with most annotations</td>
        </tr>
        <tr>
            <td><code>file-size</code></td>
            <td>largest files first</td>
        </tr>
        <tr>
            <td><code>image-width</code></td>
            <td>widest images first</td>
        </tr>
        <tr>
            <td><code>image-height</code></td>
            <td>tallest images first</td>
        </tr>
        <tr>
            <td><code>image-area</code></td>
            <td>largest images first</td>
        </tr>
        <tr>
            <td><code>creation-date</code></td>
            <td>newest to oldest (pretty much same as <code>id</code>)</td>
        </tr>
        <tr>
            <td><code>edit-date</code></td>
            <td>like <code>creation-date</code>, only looks at last edit time</td>
        </tr>
        <tr>
            <td><code>fav-date</code></td>
            <td>recently added to favorites by anyone</td>
        </tr>
        <tr>
            <td><code>comment-date</code></td>
            <td>recently commented by anyone</td>
        </tr>
        <tr>
            <td><code>feature-date</code></td>
            <td>recently featured</td>
        </tr>
        <tr>
            <td><code>feature-count</code></td>
            <td>most often featured</td>
        </tr>
    </tbody>
</table>

<p><strong>Special tokens</strong></p>

<table>
    <tbody>
        <tr>
            <td><code>liked</code></td>
            <td>posts liked by currently logged in user</td>
        </tr>
        <tr>
            <td><code>disliked</code></td>
            <td>posts disliked by currently logged in user</td>
        </tr>
        <tr>
            <td><code>fav</code></td>
            <td>posts added to favorites by currently logged in user</td>
        </tr>
        <tr>
            <td><code>tumbleweed</code></td>
            <td>posts with score of 0, without comments and without favorites</td>
        </tr>
    </tbody>
</table>

<h1 id='user-search-help'>User search tokens</h1>

<p><strong>Anonymous tokens</strong></p>

<p>Same as <code>name</code> token.</p>

<p><strong>Named tokens</strong></p>

<table>
    <tbody>
        <tr>
            <td><code>name</code></td>
            <td>having given name (doesn't accept wildcards yet)</td>
        </tr>
        <tr>
            <td><code>creation-date</code></td>
            <td>registered at given date</td>
        </tr>
        <tr>
            <td><code>creation-time</code></td>
            <td>alias of <code>creation-date</code></td>
        </tr>
        <tr>
            <td><code>last-login-date</code>
            <td>whose most recent login date matches given date</td>
        </tr>
        <tr>
            <td><code>last-login-time</code>
            <td>alias of <code>last-login-date</code>
        </tr>
        <tr>
            <td><code>login-date</code>
            <td>alias of <code>last-login-date</code>
        </tr>
        <tr>
            <td><code>login-time</code></td>
            <td>alias of <code>last-login-date</code>
        </tr>
    </tbody>
</table>

<p><strong>Order tokens</strong></p>

<table>
    <tbody>
        <tr>
            <td><code>random</code></td>
            <td>as random as it can get</td>
        </tr>
        <tr>
            <td><code>name</code></td>
            <td>A to Z</td>
        </tr>
        <tr>
            <td><code>creation-date</code></td>
            <td>newest to oldest</td>
        </tr>
        <tr>
            <td><code>creation-time</code></td>
            <td>alias of <code>creation-date</code></td>
        </tr>
        <tr>
            <td><code>last-login-date</code></td>
            <td>recently active first</td>
        </tr>
        <tr>
            <td><code>last-login-time</code></td>
            <td>alias of <code>last-login-date</code></td>
        </tr>
        <tr>
            <td><code>login-date</code></td>
            <td>alias of <code>last-login-date</code></td>
        </tr>
        <tr>
            <td><code>login-time</code></td>
            <td>alias of <code>last-login-date</code></td>
        </tr>
    </tbody>
</table>

<p><strong>Special tokens</strong></p>

<p>None.</p>