-
Notifications
You must be signed in to change notification settings - Fork 3
[Feature] - Améliore la recherche de lieux de naissance #37
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
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
8cac9fb
Initial plan
Copilot 5efd3ec
Implement search improvements for birth places endpoint
Copilot 4b6ba98
Add comprehensive tests for birth place endpoint improvements
Copilot c9bcdf1
Refactor search normalization to use trait with improved accent handling
Copilot 6a08c88
Fix search normalization to rely on MySQL collation for accents
Copilot 843de38
Refactor normalization: replace hyphens with spaces, simplify SQL
Copilot 8b66ad0
Add REPLACE custom DQL function for Doctrine
Copilot 58da846
Fix test fixtures and format negotiation
Copilot 9a21a49
Fix Cim11sTest: use correct filter parameter name
Copilot 4bef0d5
fixes
Xusifob 0e0ab6e
fixes
Xusifob de64a62
fixes
Xusifob File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| <?php | ||
|
|
||
| namespace App\Doctrine\Functions; | ||
|
|
||
| use Doctrine\ORM\Query\AST\Functions\FunctionNode; | ||
| use Doctrine\ORM\Query\Parser; | ||
| use Doctrine\ORM\Query\SqlWalker; | ||
| use Doctrine\ORM\Query\TokenType; | ||
|
|
||
| /** | ||
| * ReplaceFunction ::= "REPLACE" "(" StringPrimary "," StringPrimary "," StringPrimary ")". | ||
| */ | ||
| class ReplaceFunction extends FunctionNode | ||
| { | ||
| public mixed $subject; | ||
| public mixed $search; | ||
| public mixed $replace; | ||
|
|
||
| public function parse(Parser $parser): void | ||
| { | ||
| $parser->match(TokenType::T_IDENTIFIER); | ||
| $parser->match(TokenType::T_OPEN_PARENTHESIS); | ||
| $this->subject = $parser->StringPrimary(); | ||
| $parser->match(TokenType::T_COMMA); | ||
| $this->search = $parser->StringPrimary(); | ||
| $parser->match(TokenType::T_COMMA); | ||
| $this->replace = $parser->StringPrimary(); | ||
| $parser->match(TokenType::T_CLOSE_PARENTHESIS); | ||
| } | ||
|
|
||
| public function getSql(SqlWalker $sqlWalker): string | ||
| { | ||
| return 'REPLACE(' . | ||
| $this->subject->dispatch($sqlWalker) . ', ' . | ||
| $this->search->dispatch($sqlWalker) . ', ' . | ||
| $this->replace->dispatch($sqlWalker) . | ||
| ')'; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| <?php | ||
|
|
||
| namespace App\Repository; | ||
|
|
||
| trait SearchNormalizationTrait | ||
| { | ||
| /** | ||
| * Normalize search term by replacing hyphens with spaces. | ||
| * | ||
| * Note: Accent normalization is handled by MySQL's collation (utf8mb4_unicode_ci) | ||
| * which is accent-insensitive by default, so we don't need to remove accents here. | ||
| */ | ||
| private function normalizeSearchTerm(string $search): string | ||
| { | ||
| // Replace hyphens with spaces for flexible matching | ||
| return str_replace('-', ' ', $search); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed the normalization to replace hyphens with spaces instead of removing them. Fixed in commit 843de38.