snowstorm icon indicating copy to clipboard operation
snowstorm copied to clipboard

MRCM Range search - wrong language

Open liquid36 opened this issue 10 months ago • 8 comments

Hi! me again... I trying the MRCM endpoints. When i want to search for attributes values in Spanish, Snowstorm insist to search in English. Example:

curl -X 'GET' \
  'http://localhost:8080/mrcm/MAIN%2FSNOMEDCT-ES%2FSNOMEDCT-AR/attribute-values/263502005?contentType=NEW_PRECOORDINATED&termPrefix=crónico' \
  -H 'accept: application/json' \
  -H 'Accept-Language: es'

But if i change crónico by chronic, i get values.

Searching for query logs in Elasticsearch, i found that Snowstorm is setting the languageCode to en:

{
    "from": 0,
    "size": 10000,
    "query": {
        "bool": {
            "must": [
                ... BRANCH CRITERIA 
                {
                    "terms": {
                        "languageCode": [
                            "en"
                        ],
                        "boost": 1.0
                    }
                },
                {
                    "term": {
                        "active": {
                            "value": true
                        }
                    }
                }
            ],
            "filter": [
                {
                    "bool": {
                        "must": [
                            {
                                "bool": {
                                    "should": [
                                        {
                                            "bool": {
                                                "filter": [
                                                    {
                                                        "query_string": {
                                                            "query": "chronic*",
                                                            "fields": [
                                                                "termFolded^1.0"
                                                            ],
                                                            "default_operator": "and",
                                                            "boost": 2.0
                                                        }
                                                    }
                                                ],
                                                "boost": 1.0
                                            }
                                        },
                                        {
                                            "bool": {
                                                "filter": [
                                                    {
                                                        "query_string": {
                                                            "query": "chronic*",
                                                            "fields": [
                                                                "termFolded^1.0"
                                                            ],
                                                            "default_operator": "and",
                                                            "boost": 2.0
                                                        }
                                                    }
                                                ],
                                                "boost": 1.0
                                            }
                                        },
                                        {
                                            "bool": {
                                                "filter": [
                                                    {
                                                        "query_string": {
                                                            "query": "chronic*",
                                                            "fields": [
                                                                "termFolded^1.0"
                                                            ],
                                                            "default_operator": "and",
                                                            "boost": 2.0
                                                        }
                                                    }
                                                ],
                                                "boost": 1.0
                                            }
                                        },
                                        {
                                            "bool": {
                                                "filter": [
                                                    {
                                                        "query_string": {
                                                            "query": "chronic*",
                                                            "fields": [
                                                                "termFolded^1.0"
                                                            ],
                                                            "default_operator": "and",
                                                            "boost": 2.0
                                                        }
                                                    }
                                                ],
                                                "boost": 1.0
                                            }
                                        },
                                        {
                                            "bool": {
                                                "filter": [
                                                    {
                                                        "query_string": {
                                                            "query": "chronic*",
                                                            "fields": [
                                                                "termFolded^1.0"
                                                            ],
                                                            "default_operator": "and",
                                                            "boost": 2.0
                                                        }
                                                    }
                                                ],
                                                "boost": 1.0
                                            }
                                        },
                                        {
                                            "bool": {
                                                "filter": [
                                                    {
                                                        "query_string": {
                                                            "query": "chronic*",
                                                            "fields": [
                                                                "termFolded^1.0"
                                                            ],
                                                            "default_operator": "and",
                                                            "boost": 2.0
                                                        }
                                                    }
                                                ],
                                                "boost": 1.0
                                            }
                                        },
                                        {
                                            "bool": {
                                                "filter": [
                                                    {
                                                        "query_string": {
                                                            "query": "chronic*",
                                                            "fields": [
                                                                "termFolded^1.0"
                                                            ],
                                                            "default_operator": "and",
                                                            "boost": 2.0
                                                        }
                                                    }
                                                ],
                                                "boost": 1.0
                                            }
                                        }
                                    ],
                                    "boost": 1.0
                                }
                            }
                        ],
                        "boost": 1.0
                    }
                }
            ],
            "boost": 1.0
        }
    },
    "version": true,
    "_source": {
        "includes": [
            "descriptionId",
            "conceptId"
        ],
        "excludes": []
    },
    "sort": [
        {
            "termLen": {
                "order": "asc",
                "mode": "min"
            }
        },
        {
            "_score": {
                "order": "asc"
            }
        }
    ]
}

It appears that the Accept-Language header is only utilized for the response, rather than the query.

liquid36 avatar Apr 25 '24 11:04 liquid36