-
-
Notifications
You must be signed in to change notification settings - Fork 0
filebroker query cheat sheet
quick overview on how to use the filebroker query language
To search by tag, simply enter the tag name. A sequence of words separated by spaces is interpreted as a list of tags:
- search for posts tagged with "MassEffect", "cutscene" and "subtitles":
MassEffect cutscene subtitles
Since tags are separated by spaces, if the tag itself contains a space it must be wrapped in backticks: - search for posts tagged with "Breaking Bad":
`Breaking Bad`
Filebroker will add the backticks automatically if you select the tag from the autocomplete suggestion box
Use the !
operator to exclude tags (or negate other boolean expressions):
- Search for posts tagged with "Halo" excluding screenshots:
Halo !screenshot
Use or
/ |
to get posts tagged with one of the listed tags:
- Search for posts tagged with "drama" or "comedy":
drama or comedy
Use and
/ &
to get posts tagged with all of the listed tags:
- search for posts tagged with "MassEffect", "cutscene" and "subtitles":
MassEffect and cutscene and subtitles
You may have noticed that this is the same example as above. They are equivalent because multiple tags are aggregated into an AND junction by default. However, usingAND
explicitly is required when mixing it with other other operators in a larger expression: - Search for posts tagged with "ME2" and "video" or tagged with "ME3" and "screenshot":
(ME2 and video) or (ME3 and screenshot)
Note that tags that are explicitly connected via an operator take precedence over implicitly joining them, thussitcom crossover or special
is equivalent tositcom and (crossover or special)
Posts have many attributes that can be accessed using the @
operator, think @ for ATtribute.
- Check if post title is equal to "Vantage":
@title = "Vantage"
- Check if post title contains "Best":
@title ~= "Best"
- Check if upload date is after the 1st of May 2023:
@date > "2023-05-01"
- Check if description contains "needle":
@description ~= "needle"
- Check if description ends with "matter":
@description ~= "%matter"
Attributes are used in tandem with the following operators: (all text comparisons are case insensitive)
-
=
: check if an attribute is equal to the given value -
!=
: check if an attribute is not equal to the given value -
>
: check if an attribute is greater than the given value -
>=
: check if an attribute is greater than or equal to the given value -
<
: check if an attribute is less than the given value -
<=
: check if an attribute is less than or equal to the given value -
~=
: check if an attribute is 'like' the given value. This operator only works for text and determines if the attribute contains the given value. You can optionally use the wildcards%
(any 0 or more characters) or_
(any 1 character) to define a pattern. "North%" means "starts with 'North' following any number of characters", "_up" means "ends with 'up', starting with any one character"
The following attributes are available for posts:
-
@date
: upload timestamp of the post -
@title
: post title -
@description
: post description -
@uploader
: ID of the upload user -
@type
: MIME type of the uploaded file (e.g. "video/mp4" or "image/jpeg") -
@composer
: composer extracted from file metadata -
@genre
: genre extracted from file metadata -
@date_meta
: creation date of the uploaded file -
@duration
: video or audio duration -
@track
: Number of the track within an album, typically in a format like "4 of 13" -
@disc
: Number of disc within collection, appears in albums with multiple discs -
@width
: width in pixels -
@height
: height in pixels -
@size
: file size in bytes
When searching for collections, you only get @title
, @description
, @date
and @owner
(collection creator)
Accessing variables is prefixed with the :
operator. The following variables are available for use in queries:
-
:self
: The ID of the currently logged in user -
:now
: The current timestamp, e.g. "2024-05-28 02:29" -
:now_date
: The current day, e.g. "2024-05-28"
Search posts you uploaded: @uploader = :self
Search posts uploaded within the last 24 hours: @date > :now - "24:00:00"
may also be written as a postgres interval string (or ISO 8601), see postgres docs
The sort modifier may be used to order results by a given attributes:
- Sort results by upload date:
%sort(@date)
- Sort results by uploader in descending order:
%sort(@uploader, "desc")
Find posts of pets, excluding hamsters, at home or at a park, with a title that contains "Foo", sorted by upload date, most recent first
pet !hamster (home or park) @title ~= "Foo" %sort(@date, "desc")