[.NET] UAX URL Email Tokenizer Issue

Hi,

I have been using ElasticSearch through Nest (.NET technology) for a while now. I am currently working on an application where the user can do some search and more precisely looking for someone by typing an email for example.

After some tests and some research, I noticed that working on emails will request to set an uax_url_email tokenizer while creating the given index. Sadly, I have some issue to set this setting correctly and I can't retrieve the users while typing their email. Here is my code:

var result = client?.CreateIndex(indexName, i => i

// Auto mapping with our UserModel entity
.Mappings(ms => ms.Map(m => m.AutoMap()))

// Setting an analyzer to use an uax_url_email tokenizer
.Settings(s => s.Analysis(a => a.Analyzers(aa => aa.Custom("my_analyzer", t => t.Tokenizer("my_tokenizer"))).Tokenizers(n => n.UaxEmailUrl("my_tokenizer", t => t)))));

As the second comment is saying, I am using an analyzer to use the needed tokenizer since I can't find any attribute working with this last one for the Attribute Mapping:

[Text(Analyzer = "my_analyzer")]
public string Email { get; set; }

If anyone has some time, could you guys help me with this situation ? Otherwise, is there an attribute that I may not be aware of for the tokenizer and that will prevent me to create the analyzer ?

I thank you in advance and wish you a great day !
Best regards,
MT WSM

Hi guys,

Sorry, but the issue was coming from my test. The above code is working perfectly fine !

N.B.: When I copied-pasted my code, I forgot a piece of it:

// Auto mapping with our UserModel entity
.Mappings(ms => ms.Map(m => m.AutoMap()))

// Shoud be:

// Auto mapping with the UserModel entity
.Mappings(ms => ms.Map/</UserModel/>/(m => m.AutoMap()

EDIT: Apparently, it was the quote system that removed the missing part... Remove the for '/' characters to retrieve the correct code.

Best regards,
MT WSM

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