lichess.org
Donate

Help with Lichess Database Search

I'd like to create a game collection consisting of games in the Lichess database that fit the following criteria: (1) played between players in a specified rating range; (2) using a specified opening; (3) with a specified maximum number of moves; and (4) with a specified result (i.e., White wins, Black wins). I found an Advanced Search function on Lichess that accommodates all of these *except* #2 (i.e., using a specified opening). Do you know of a search tool that accommodates all four of these criteria? Thanks in advance.
Is there supposed to be a "Quickstart guide"? Is it all written on X or is there a link elsewhere to it? When I click on that X post I don't see anything else but the repost to bookmarks numbers.
Maybe you have to have an account to see the whole thread. It's free.
Yea, that's it. I went on the browser that's logged in. The upshot is the database is huge. I wonder if there is a way to only get certain openings.
Thanks for your response, @danbock. No, I don't have any coding skills. I'd guess that this feature (i.e., the ability to search for a specified opening, along with the other criteria that already covered) would be useful for other Lichess members, as well. If someone with coding skills is willing to make this happen, it would be a gift.
I have done something similar to what you wanted in the past using ChessBase. However, you first have to download the database from database.lichess.org/. As mentioned before, it's quite large, even for just one month's worth of data—30 GB when zipped and 100 GB when uncompressed. Furthermore, processing such a database with ChessBase is no easy task, taking several hours just for indexing on my old laptop.

It might be more efficient if you can code, perhaps to randomly select 10 million games from the database and then process them using ChessBase.
You can do this with pgn-extract: www.cs.kent.ac.uk/people/staff/djb/pgn-extract/
with a -t flag and for example this tagfile:

Opening "Sicilian"
WhiteElo > "2000"
BlackElo > "2000"
Result "0-1"

This will work a little bit faster than anything written in Python or JavaScript since it's C :)

pgn-extract -s -t tags.txt -o out.pgn --maxmoves 30 lichess.pgn

See full description link there for explanations and examples.

There is also database.nikonoel.fr with already filtered games. Could be easier to process if your search criteria are similar. Though I don't think Opening tags are included, so you would need to either filter out by ECO or do ECO classification (can do with pgn-extract and its eco.pgn).
Also see TSV (tab-separated values) files github.com/lichess-org/chess-openings if you want to create your own eco.pgn based on Lichess names. Bear in mind that the names might have changed over time.
@bufferunderrun said in #8:
> You can do this with pgn-extract: www.cs.kent.ac.uk/people/staff/djb/pgn-extract/

I guess I learned something new today.
Can it also filter something like Isolani or Hanging Pawns ?
I've been trying to filter my own games for those.

This topic has been archived and can no longer be replied to.