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

Name | parameters | arguments | example |
---|---|---|---|

A | `A==2` | ||

a | `a==2` | ||

abs | number | `abs #A - #a` | |

ancestor | (position position) | `ancestor(source target)` | |

and | filter/filter | `check and Q==2` | |

attackedby | set/set | ` _ attackedby k` | |

attacks | set/set | `A attacks k` | |

B | `B==2` | ||

b | `b==2` | ||

between | (set set) | `between(R k)` | |

black | `black` | ||

btm | `btm` | ||

check | `check` | ||

child | (number) | `child(3)` | |

child | `child` | ||

colortype | set | `colortype d4` | |

comment | (filter...) | `comment("x is" x)` | |

connectedpawns | `connectedpawns` | ||

consecutivemoves | rangequiet | (position position) | `consecutivemoves(source target)` |

currentposition | `currentposition` | ||

dark | set | `dark B` | |

depth | `depth>4` | ||

descendant | (position position) | `descendant(source target)` | |

distance | (position position) | `distance(source target)` | |

doubledpawns | `doubledpawns>= 4` | ||

down | range | set | `down P` |

echo | in all | (variable variable) | `echo(s t)s&t==.` |

elo | white black | `elo>2700` | |

event | string | `event "Baden"` | |

false | `false` | ||

fen | string | `fen "8/8/8/8/8/8/8/6K.k"` | |

file | set | `file K` | |

find | rangeall <-- | filter | `find check` `find all check` |

flip | range | filter | `flip Ad4 attacks k` |

flipcolor | range | filter | `flipcolor A attacks k` |

fliphorizontal | range | filter | `fliphorizontal Ae1 attacks k` |

flipvertical | range | filter | `flipvertical Ae1 attacks k` |

function | {filter} | `function square(x) {x * x}` | |

gamenumber | `gamenumber==1000` | ||

hascomment | string | `hascomment "good"` | |

if | then else | filter | `if check then K else Q` |

in | set/set | `R in (A attacks k)` | |

initial | `initial` | ||

isolatedpawns | `isolatedpawns>3` | ||

K | `K attacks n` | ||

k | `k attacks n` | ||

lca | (position position) | `lca(source target)` | |

left | range | set | `left P` |

light | set | `light B==2` | |

line | firstmatch lastposition singlecolor nestban primary rangesecondary | filter | `line-->move promote A-->mate` |

loop | filter | `loop {child(i) i+=1}` | |

mainline | `mainline` | ||

makesquare | (number number) | `makesquare(File Rank)` | |

mate | `mate` | ||

max | (number number) | `max(#R #Q)` | |

message | (filter...) | `message("x is " x)` | |

min | (number number) | `min(#R #Q)` | |

move | capture castle comment count enpassant enpassantsquare from legal null o-o o-o-o previous primary promote pseudolegal secondary to | `move from K to _ ` | |

movenumber | `movenumber>100` | ||

N | `N==2` | ||

n | `n==2` | ||

northeast | range | set | `northeast P` |

northwest | range | set | `northwest P` |

not | filter | `not mate` | |

or | filter/filter | `check or stalemate` | |

P | `P==2` | ||

p | `p==2` | ||

parent | `parent:check` | ||

passedpawns | `passedpawns>= 6` | ||

persistent | variable=number | `persistent x=5` | |

piece | in all | filter | `piece x in A x attacks k` |

piece assignment | variable=set | `piece x = K` | |

pieceid | set | `pieceid x` | |

pin | from through to | `pin from Q` | |

player | white black | string | `player "Kasparov"` |

ply | `ply>100` | ||

position | number | `position 0` | |

power | set | `power A<5` | |

Q | `Q==2` | ||

q | `q==2` | ||

R | `R==2` | ||

r | `r==2` | ||

rank | set | `rank K == rank k` | |

ray | direction | (set...) | `ray (R a k)` |

result | string | `result "1-0"` | |

reversecolor | range | filter | `reversecolor A attacks k` |

right | range | set | `right P` |

rotate45 | range | filter | `rotate45 A attacks right k` |

rotate90 | range | filter | `rotate90 A attacks up k` |

shift | range | filter | `shift A e1 attacks kg1` |

shifthorizontal | range | filter | `shifthorizontal Ae1 attacks kg1` |

shiftvertical | range | filter | `shiftvertical Ae1 attacks kg1` |

sidetomove | `sidetomove==white` | ||

site | string | `site "Berlin"` | |

sort | mindocumentation | number or set | `sort "Material" power A` |

sqrt | number | `sqrt 10000` | |

square | in all | filter | `square s in _ k attacks s` |

stalemate | `stalemate` | ||

terminal | `terminal` | ||

true | `true` | ||

type | set | `type d4` | |

up | range | set | `up P` |

variation | `variation` | ||

virtualmainline | `virtualmainline` | ||

white | `white` | ||

wtm | `wtm` | ||

xray | (set...) | `xray(R a k)` | |

year | `year>2000` |