# Searches in Scid

Scid can perform many different types of search on a database. The three main types of search are:

- 1) for the current board,
- 2) for specified material and piece patterns, and
- 3) by header information such as players, result, date.

In addition to these, there is also an automatic search mode called the Tree window which is explained separately.

### The Search Filter

Searches in Scid are based on the concept of a filter. The filter represents a subset of the current database; at any time, each game is either included in or excluded from the filter.

With each type of search, you can choose to restrict the existing filter, add to it, or ignore it and search the whole database. This choice permits complex searches to be built up incrementally.

You can also copy all games in the filter of one database to another, using the database switcher window.

With exact position, tree or material/pattern searches, the move number of the first matching position of each matching game is remembered, so when you load each game it will show the matching position automatically.

Note that searches only apply to the main line moves of a game, not to any moves in variations.

### Search: Current Board

This search finds games that contain the current displayed position, ignoring castling and en passant rights.

There are four board search types available. All four require a position to have the same exact material and side to move for a match. The types are:

- [1] exact (the two positions must match on every square),
- [2] pawns (the pawn structure must match exactly, but other pieces can be anywhere),
- [3] files (the number of white and black pawns on each file must match exactly, but other pieces can be anywhere), and
- [4] material (pawns and pieces can be anywhere).

The pawns search is useful for studying openings by pawn structure, and the files and material searches are useful for finding similar positions in an endgame.

To search for an arbitrary position, you can set the position first (from the [Edit: Setup Start Board] menu) and then start the search.

You can request that the search look in variations (instead of only examining actual game moves) by selecting the Look in variations checkbox, but this may make the search much slower if your database is large and has many games with variations.

### Search: Material/Pattern

This search is useful for finding endgame or middlegame themes. You can specify minimum and maximum amounts of each type of material, and find patterns such as a Bishop on f7, or a pawn on the f-file.

A number of common material and pattern settings are provided, such as Rook vs. Pawn endings, or isolated Queens pawns.

Hints:
The speed of pattern searches can vary widely. You can reduce the time needed for a search by setting restrictions intelligently. For example, if you set the minimum move number to 20 for an ending, all games that end in under 20 moves can be skipped.

### Search: Header

This search can be used to find aspects of the game that are stored in the header (such as date, result, names, flags and ratings), so it does not require any moves to be decoded.

For a game to match a Header search, all fields that you specify must match.

The name fields (White, Black, Event, Site and Round) match on any text inside the name, case-insensitive and ignoring spaces.

You can do case-sensitive wildcard searches for the White, Black, Event, Site and Round fields (with ? representing one character and * representing zero or more characters) by putting the search text in double quotes. For example a search for the site USA will find American cities and also Lausanne SUI, which is probably not what you wanted! A search for the site "*USA" (remember to use the double-quotes) will only match cities in the United States.

If you are searching for a particular player (or pair of opponents) as White or Black and it does not matter what color they played, select the Ignore Colors option.

Finally, the Header search can be used to find any text (case-sensitive and without wildcards) in the PGN representation of each game. You may enter up to three text phrases, and they must all appear in a game for it to be a match. This search is very useful for searching in the comments or extra tags of a game (such as lost on time or Annotator), or for a move sequence like Bxh7+ and Kxh7 for a bishop sacrifice on h7 that was accepted. However, this type of search can be very slow since all the games that match other criteria must be decoded and scanned for the text phrases. So it is a good idea to limit these searches as much as possible. Here are some examples. To find games with under-promotions to a rook, search for =R and also set the Promotions flag to Yes. When searching for text that would appear in comments, set the Comments flag to Yes. If you are searching for the moves Bxh7+ and Kxh7, you may want to restrict the search to games with a 1-0 result and at least 40 half-moves, for example, or do a material/pattern search first to find games where a white bishop moves to h7.

### Saving search settings

The Material/Pattern and Header search windows provide a Save settings button. This lets you save the current search settings for later use, to a SearchOptions file (suffix .sso). To search using a previously saved SearchOptions (.sso) file, select [Open] from the [Search] menu.

### Search times and skipped games

Most searches produce a message indicating the time taken and the number of games that were skipped. A skipped game is one that can be excluded from the search without decoding any of its moves, based on information stored in the index. See the help page on file formats for more information.

(Updated: Scid 3.0, November 2001)