Reputation: 1
I'm looking for a third solution where "Alicex Flicex" will not return "Alice Maria Bobsson" and "Alice Bobsson" will return "Alice Maria Bobsson"
{
name: {
firstName: 'Alice Maria',
lastName: 'Bobsson',
fullName: 'Alice Maria Bobsson'
}
}
[
{
"$search": {
"index": "indexName",
"compound": {
"must": [
{
"compound": {
"should": [
{
"text": {
"query": "Alicex",
"path": "name.firstName",
"fuzzy": {
"maxEdits": 2
}
}
},
{
"text": {
"query": "Alicex",
"path": "name.lastName",
"fuzzy": {
"maxEdits": 2
}
}
}
]
}
},
{
"compound": {
"should": [
{
"text": {
"query": "Flicex",
"path": "name.firstName",
"fuzzy": {
"maxEdits": 2
}
}
},
{
"text": {
"query": "Flicex",
"path": "name.lastName",
"fuzzy": {
"maxEdits": 2
}
}
}
]
}
}
]
}
}
}
]
name: Alicex Flicex
Expected result
Not return "Alice Maria Bobsson"
Actual result
Returning "Alice Maria Bobsson"
Reasons
[
{
"$search": {
"index": "indexName",
"compound": {
"must": [
{
"text": {
// "query": "Alicex Flicex", Name corrected with next line
"query": "Alice Bobsson",
"path": "name.fullName",
"fuzzy": {
"maxEdits": 2
},
"matchCriteria": "all"
}
}
]
}
}
}
]
name: Alice Bobsson
Expected result
Return "Alice Maria Bobsson"
Actual result
Do not return "Alice Maria Bobsson"
Reasons
Upvotes: 0
Views: 56