Search as like in elaticsearch with vietnamese

I use package elaticsearch in laravel framework:

I has task search name customer when i enter name into input search.
I want search as like in elacticsearch. I want typing "an" will return "Tân", "Ánh","Bằng",..

this is query search api :

public function autocomplete(Request $request)
{
    $name = $request->query('q');
    $customers = Customer::searchByQuery([
        'wildcard' => [ 
            'name' => '*'.$name.'*'
        ]
    ]);
}   

This is model customer :
class Customer extends Model
{
use ElasticquentTrait;

        protected $table = 'customers';
        protected $fillable = [ 'name' ];
        protected $hidden = [ 'created_at', 'updated_at', 'deleted_at' ];

        protected $mappingProperties = array(
            'name' => [
                'type' => 'text',
                "analyzer" => "standard",
            ],
        );
        
        protected $indexSettings = [
            'analysis' => [
                'analyzer' => [
                    'my_custom_analyzer' => [
                        'type' => 'custom',
                        'char_filter' => [
                            'html_strip',
                            'replace',
                        ],
                        'tokenizer' => 'standard',
                        'filter' => [
                            'lowercase',
                            'asciifolding',
                        ],
                    ],
                ],
            ],
        ];
    }

I hope someone can help me. Thanks you very much

"an" is an english word though "Tân", "Ánh","Bằng" are vietnamese words. So you should try search useing a vietnamese word. And I don't think the wildcard query support vietnamese.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.