How to make a search query in CDJ

The Basics

Jump to the advanced stuff!

CDJ queries work by finding pieces of music or whole discs which have attributes that match the relationship you specify in your query.

The basic format of a simple query is:

(Field) (Comparison) (Value)

some examples of this format would be

title = love
album == "moving pictures"
artist = elvis
playtime > 1:30
timelastplayed < 4d
timereleased > 1/1/68

Fields

The following fields are supported, along with shorthand equivalents. Expect that many new fields will be added in the future.

Fields

Name Shorthand Data Type Description
title ti text title of track
artist ar text name of artist
album al text title of album (disc)
lyrics ly text lyrics of track
notes no text notes for track / disc
player pl number number of player on which music resides
keywords kw text user defined keywords
playtime pt playtime playing time of music
timeadded ta datetime date / time the music was added to your collection
timeplayed tp playtime amount of time this music has been played
timesplayed nt number number of times this music has been played
timereleased tr datetime date / time the music was released
timelastplayed tl datetime date / time the music was last played
like     -20 to +20 slider rating*
happy     -20 to +20 slider rating*
tempo     -20 to +20 slider rating*
danceable     -20 to +20 slider rating*

* these names will eventually become user definable

Comparisons

The following types of comparisons are supported.

Comparisons

Symbol Description
= numbers - equals
strings - is found within
== numbers - equals
strings - is identical (not case sensitive)
> is less than (works for strings too)
< is greater than (works for strings too)

Data Types

The following data types are supported.

Data Types

Name Description Samples
text A text string. If a string contains spaces or characters which could be construed as comparisons or boolean operators, it should be enclosed in quotes.
dog
"kitty cat"
"<test>"
number An integer or floating point number
1
-3
42.705
playtime Time expressed as seconds or in a minutes:seconds format
35
4:33
datetime Time expressed in one of the following formats

 

 
Absolute - these formats express an absolute time
"25 January 1996"
"January 25, 1996 8:30:00"
"8:30:00 Jan. 25, 1996"
"1/25/1996 8:30:00" 
"6/23/99"
Relative - these formats express time as an offset to the past from the current time. The default unit is the day, but the following units are supported:
y - years
o - months
w - weeks
d - days
h - hours
m - minutes
s - seconds
1.77y
3o
3.5w
22d
3h
12m
100s

The advanced stuff

CDJ allows you to make boolean queries of unlimited complexity along with some special features to make expressions even more compact. The following boolean operators are supported:

 

Boolean Operators (in order of precedence)

Symbol Shorthand Function
not ! invert the logical sense of the expression to the right
and & expression to the left and right must be true
or | expression to the left or right must be true
xor ^ only one expression to the left or right must be true

CDJ also allows the use of parentheses to control the order of operations in an expression.

The following is an example of a more advanced query

(title="shot the sheriff" and (ar=elvis | not player<2)) ^ (album=odelay or like>5)

The CDJ expression syntax also allows you to factorize both fields and values using boolean operators to create queries with less typing.

Instead of saying

keyword=fun & (keyword=punk ^ keyword=female)

You can just say

keyword=(fun & (punk ^ female))

Likewise, fields can be condensed. Instead of saying

artist = elvis | album = elvis | title = elvis

You can just say

(artist | album | title) = elvis

Factorizations can be done on both sides simultaneously

(artist | title) = (cat & dog)

is equivalent to

artist=cat & artist=dog | title=cat & title=dog

Special Defaults

To make things more convenient, if you just type in some text, such as

elvis

CDJ will default to interpreting this as

(title | artist | album | keywords) = elvis