Documentation

CQLi Documentation

Read the reference manual one chapter at a time, or open the complete manual on a single page to search all of it at once.

Manual Chapters

Introduction

Where CQL and CQLi came from, the notation used in this manual, and system requirements.

CQL Fundamentals

How a query is evaluated, a brief tour of the language, operators, strings, regular expressions, and common pitfalls.

Comments

Adding comments to matching games, and how CQLi orders, merges, and deduplicates them.

Board State Filters

Attacks, check and mate, side to move, FEN strings, pawn structure, and promoted pieces.

Board Geometry Filters

Directions from a square, squares between two others, light and dark squares, files, and ranks.

Ray Filters

Lines of pieces along ranks, files, and diagonals, including x-rays and pins.

The Gametree Filters

Moving around the game tree: parents and children, variations, the main line, and distances between positions.

The sort Filter

Ordering the output games by a value the query computes, and how ties and multiple sort filters are handled.

The move Filter

Matching moves by piece, square, capture, promotion, or castling, including legal moves that were not played.

The line Filter

Matching sequences of positions through a game, such as a run of checks or a series of captures.

Functions

Writing reusable functions and importing them from other files.

Transform Filters

Writing a pattern once and matching it in every orientation and color with flips, rotations, and shifts.

Chess Variants

Chess960, Crazyhouse, Atomic, Horde, and other variants, and how filters behave in each.

Other Features

Piece tracking, splitting output across files, JSON output, multithreading, Command Pipe, and the HHdb interface.

Synoptic Examples

Short queries for pawn structures, castling, promotions, tactics, tags, comments, and output files.

Expository Examples

Longer worked examples, from repetition detection and statistics to chess problems and 30 mating patterns.

Filter Conspectus

Tables of every filter and keyword, operator precedence, and order of evaluation.

Commandline Options

Every command line option, from selecting input games to PGN output formatting and filter injection.

Diagnostics

How errors, warnings, and infos are reported, with every warning and info message listed.