The GET /v1/autocomplete/player endpoint has demonstrated to be not effective for autocompleting players names while users are entering input in the Search Games dialog. See https://github.com/chesslablab/website/issues/111
This is mainly due to the fact that all players names are currently being downloaded first in the form of an array for the browser to then perform search queries on that huge array.
Figure 1. Click on Search Games and enter some text in the White or in the Black text fields.
Attached below is the current code for the GET /v1/autocomplete/player endpoint.
<?php
namespace ChessApi\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
class AutocompletePlayerController extends AbstractController
{
const DATA_FOLDER = __DIR__.'/../../data/autocomplete';
const AUTOCOMPLETE_PLAYER_FILE = 'players.json';
public function index(Request $request): Response
{
$content = file_get_contents(self::DATA_FOLDER.'/'.self::AUTOCOMPLETE_PLAYER_FILE);
$response = new Response();
$response->setContent($content);
$response->headers->set('Content-Type', 'application/json');
return $response;
}
}
This endpoint needs to be reimplemented as a POST request in order to perform a database search based on the incoming input value rather than downloading the players.json file.
The
GET /v1/autocomplete/player
endpoint has demonstrated to be not effective for autocompleting players names while users are entering input in the Search Games dialog. See https://github.com/chesslablab/website/issues/111This is mainly due to the fact that all players names are currently being downloaded first in the form of an array for the browser to then perform search queries on that huge array.
Figure 1. Click on Search Games and enter some text in the White or in the Black text fields.
Attached below is the current code for the
GET /v1/autocomplete/player
endpoint.This endpoint needs to be reimplemented as a POST request in order to perform a database search based on the incoming input value rather than downloading the
players.json
file.Happy coding!