This table lists the filters in CQL as well as parameters or keywords each filter uses. This table is not normative: consult the documentation for the filter for the normative definition.

This table does not include symbolic filters: ., _, :, &, <, >, >=, =, =?, ==, !=, +, *, %, /, -, ~, |, {}, #, +=, -=, /=, *=, %=.

Table of Filters

Nameparametersargumentsexample
AA==2
aa==2
absnumberabs #A - #a
ancestor(position position)ancestor(source target)
andfilter/filtercheck and Q==2
attackedbyset/set _ attackedby k
attacksset/setA attacks k
BB==2
bb==2
between(set set)between(R k)
blackblack
btmbtm
checkcheck
child(number)child(3)
childchild
colortypesetcolortype d4
comment(filter...)comment("x is" x)
connectedpawnsconnectedpawns
consecutivemovesrange
quiet
(position position)consecutivemoves(source target)
currentpositioncurrentposition
darksetdark B
depthdepth>4
descendant(position position)descendant(source target)
distance(position position)distance(source target)
doubledpawnsdoubledpawns>= 4
downrangesetdown P
echoin
all
(variable variable)echo(s t)s&t==.
elowhite
black
elo>2700
eventstringevent "Baden"
falsefalse
fenstringfen "8/8/8/8/8/8/8/6K.k"
filesetfile K
findrange
all
<--
filterfind check
find all check
flipcountfilterflip Ad4 attacks k
flipcolorcountfilterflipcolor A attacks k
fliphorizontalcountfilterfliphorizontal Ae1 attacks k
flipverticalcountfilterflipvertical Ae1 attacks k
function{filter}function square(x) {x * x}
gamenumbergamenumber==1000
hascommentstringhascomment "good"
ifthen
else
filterif check then K else Q
inset/setR in (A attacks k)
initialinitial
isolatedpawnsisolatedpawns>3
KK attacks n
kk attacks n
lca(position position)lca(source target)
leftrangesetleft P
lightsetlight B==2
linefirstmatch
lastposition
singlecolor
nestban
primary
range
secondary
filterline-->move promote A-->mate
loopfilterloop {child(i) i+=1}
mainlinemainline
makesquare(number number)makesquare(File Rank)
matemate
max(number number)max(#R #Q)
message(filter...)message("x is " x)
min(number number)min(#R #Q)
movecapture
castle
comment
count
enpassant
enpassantsquare
from
legal
null
o-o
o-o-o
previous
primary
promote
pseudolegal
secondary
to
move from K to _
movenumbermovenumber>100
NN==2
nn==2
northeastrangesetnortheast P
northwestrangesetnorthwest P
notfilternot mate
notransformfilternotransform a4
orfilter/filtercheck or stalemate
PP==2
pp==2
parentparent:check
passedpawnspassedpawns>= 6
persistentvariable=numberpersistent x=5
piecein
all
filterpiece x in A x attacks k
piece assignmentvariable=setpiece x = K
pieceidsetpieceid x
pinfrom
through
to
pin from Q
playerwhite
black
stringplayer "Kasparov"
plyply>100
positionnumberposition 0
positionidpositionid == 0
powersetpower A<5
QQ==2
qq==2
RR==2
rr==2
ranksetrank K == rank k
ray direction (set...)ray (R a k)
resultstringresult "1-0"
reversecolorcountfilterreversecolor A attacks k
rightrangesetright P
rotate45countfilterrotate45 A attacks right k
rotate90countfilterrotate90 A attacks up k
shiftcountfiltershift A e1 attacks kg1
shifthorizontalcountfiltershifthorizontal Ae1 attacks kg1
shiftverticalcountfiltershiftvertical Ae1 attacks kg1
sidetomovesidetomove==white
sitestringsite "Berlin"
sortmin
documentation
number or setsort "Material" power A
sqrtnumbersqrt 10000
squarein
all
filtersquare s in _ k attacks s
stalematestalemate
terminalterminal
truetrue
typesettype d4
uprangesetup P
variationvariation
virtualmainlinevirtualmainline
whitewhite
wtmwtm
xray(set...)xray(R a k)
yearyear>2000