Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The "Draw" filter for Advanced Search excludes draws by stalemate and insufficient mating material #16508

Open
johndoknjas opened this issue Nov 30, 2024 · 4 comments

Comments

@johndoknjas
Copy link
Contributor

johndoknjas commented Nov 30, 2024

Exact URL of where the bug happened

https://lichess.org/@/ChessTheory64/search?players.a=chesstheory64&status=32&sort.field=d&sort.order=desc

https://lichess.org/@/ChessTheory64/search?players.a=chesstheory64&status=34&sort.field=d&sort.order=desc

Steps to reproduce the bug

  1. If you go to the first url, you'll see two 5+5 rapid games at the top that ended in stalemate. However, changing the Result filter from Stalemate to Draw (second url) will not show these two games.
    Same story for Clock Flag, in cases where insufficient mating material makes the game a draw.

What did you expect to happen?

Stalemates and clock flags should be included as draws.

What happened instead?

They aren't. It's because stalemate and clock flags are their own type of result/status, and the query to the db uses that.

Operating system

Windows 11

Browser and version (or alternate access method)

Chrome

Additional information

No response

@mainali123
Copy link

@lenguyenthanh Is this issue related to this repo or lila-search repo?

@cymruu
Copy link

cymruu commented Dec 18, 2024

@mainali123, you didn't ask me, but I looked into this issue today and here’s what I learned. There are two ways to search for games:

  1. Simple Search: Used for simple queries.
  2. Advanced Search: Handled by the lila-search repository, uses under the hood Elasticsearch
Screenshot 2024-12-18 at 19 31 43

When using the simple search, the following query is used:

def draw(u: UserId): Bdoc = user(u) ++ finished ++ F.winnerId.$exists(false)

This query works correctly because it lists all user's finished games that don't have winner eta all draws - i.e no matter how the draw occurred.

However, the lila-search repository searches for games with a selected status, which means it only returns games that ended with the selected status. Drawn games, can end with different statuses, so you don't receive all drawn user games.

@lenguyenthanh
Copy link
Member

thanks @cymruu, your investigation is totally correct. We could solve this by making lila-search's query more sophisticated like include statemate and clock flag when searching for draw.

@mainali123
Copy link

There might be a reason for categorizing stalemates separately. Although a stalemate results in a draw, it is specifically a draw by stalemate. I'm not sure if it is the right idea to display stalemate games under the general draw category, as it could negate the use of advanced search filters.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants