I use Atlas Search in free tier, I have a full text index on multiple fields of a product.
Here is my full text index definition :
{
"analyzer": "lucene.french",
"searchAnalyzer": "lucene.french",
"mappings": {
"dynamic": false,
"fields": {
"brand": {
"analyzer": "lucene.french",
"indexOptions": "positions",
"norms": "omit",
"searchAnalyzer": "lucene.french",
"store": false,
"type": "string"
},
"category": {
"fields": {
"name": {
"analyzer": "lucene.french",
"indexOptions": "positions",
"searchAnalyzer": "lucene.french",
"store": false,
"type": "string"
}
},
"type": "document"
},
"color": {
"analyzer": "lucene.french",
"indexOptions": "positions",
"searchAnalyzer": "lucene.french",
"store": false,
"type": "string"
},
"description": {
"analyzer": "lucene.french",
"searchAnalyzer": "lucene.french",
"store": false,
"type": "string"
},
"gender": {
"analyzer": "lucene.french",
"indexOptions": "positions",
"norms": "omit",
"searchAnalyzer": "lucene.french",
"store": false,
"type": "string"
},
"name": {
"analyzer": "lucene.french",
"norms": "omit",
"searchAnalyzer": "lucene.french",
"store": false,
"type": "string"
}
}
},
"synonyms": [
{
"analyzer": "lucene.french",
"name": "gender_synonym",
"source": {
"collection": "gender_synonym"
}
}
]
}
I activate synonyms on gender words to have the translation working in English and French here an example of synonym document :
{
"mappingType": "equivalent",
"synonyms": [
"masculin",
"male",
"homme",
"man"
]
}
When I use the synonym in a pipeline with $search I don't see any impact on the score of the results. Here is my $search pipeline :
[
{
$search: {
index: 'search',
compound: {
minimumShouldMatch: 2,
should: [
{
text: {
query: "tee shirt rose homme",
path: ['category'],
score: {
boost: {
value: 5,
},
},
},
},
{
text: {
query: "tee shirt rose homme",
path: ['gender'],
score: {
boost: {
value: 5,
},
},
synonyms: "gender_synonym"
},
},
{
text: {
query: "tee shirt rose homme",
path: ['color', 'brand', 'name'],
score: {
boost: {
value: 1.5,
},
},
},
},
{
text: {
query: "tee shirt rose homme",
path: 'description',
score: {
boost: {
value: 1,
},
},
},
},
],
},
},
}
]
As you can see in my query there is the word homme which is in my synonym document. Did i do something wrong ?