Hi all! Im having an issue that I cant find by email using Atlas Search.
This is what I built at the moment:
const suggestedFriends = await this.usersModel
.aggregate<SuggestedFriends>()
.search(
{
index: 'default',
wildcard: {
query: `${friendsQuery.q}*`,
path: 'email',
allowAnalyzedField: true,
},
}
)
What im sending on the variable friendsQuery.q is “tomas@gmail.com ” but not found nothing. I tried to use another collection that I have names and works properly, I mean the search index its working but not works on strings of emails :/. Someone faced this thing too?
Thank you so much!
Elle_Shwer
(Elle Shwer)
August 22, 2022, 10:01pm
2
Can you share your index definition?
We have an email tokenizer , which helps with this.
3 Likes
Thanks for quickly response here its my index definition
Marcus
(Marcus Eagan)
August 23, 2022, 11:27pm
4
@tomas_ruffa That analyzer won’t work because the lucene.simple
analyzer will strip the @
symbol and the .
from the email.
In the visual editor, we do not support the custom analyzer you should build to support this use case.
It would look something like this:
{
"analyzer": "lucene.simple",
"mappings": {
"dynamic": true,
"fields": {
"email": {
"analyzer": "emailUrlExtractor",
"searchAnalyzer": "emailUrlExtractor",
"type": "string"
}
}
},
"analyzers": [
{
"charFilters": [],
"name": "emailUrlExtractor",
"tokenFilters": [
{
"type": "lowercase"
}
],
"tokenizer": {
"maxTokenLength": 200,
"type": "uaxUrlEmail"
}
}
]
}
2 Likes
Thank you so much Marcus I did this and added new refactors to that query by the Atlas UI and now works. Thanks @Elle_Shwer too for the help, both are the solution that I need
2 Likes
system
(system)
Closed
August 29, 2022, 3:54pm
6
This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.