Skip to content

Commit

Permalink
Dont index sorting symbols
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthias Richter committed Oct 9, 2024
1 parent 4cd9881 commit 75855eb
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Classes/Command/IndexCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Elastic\Elasticsearch\Client;
use Illuminate\Support\Collection;
use Illuminate\Support\Str;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
Expand Down Expand Up @@ -793,11 +794,24 @@ protected function fetchObjects(): void
}

$data = $qb->execute()->fetchAll();
if ($name == 'person') {
$data = Collection::wrap($data)->
map(function ($person) { return self::removeSortingSymbols($person); });
}

$this->dataObjects[$name] = $data;
}
}

protected static function removeSortingSymbols(array $person): array
{
$name = Str::of($person['name'])->
replace('˜', '')->
replace('œ', '');
$person['name'] = $name;
return $person;
}

/**
* Executes an indexing sequence
*
Expand Down

0 comments on commit 75855eb

Please sign in to comment.