NCIOCPL / drug-dictionary-api

NCI Drug Dictionary API
0 stars 3 forks source link

Search contains query doesn't find matches on word boundaries with a dash. #21

Closed blairlearn closed 4 years ago

blairlearn commented 4 years ago

Issue description

A search for the term paclitaxel should match the term carboplatin-Taxol regimen which has carboplatin-paclitaxel regimen as an alias.

ESTIMATE 20

Steps to reproduce the issue

  1. Use the query
    POST /drugv1/terms/_search
    {
    "from": 0,
    "size": 200,
    "_source": {
        "includes": [
            "aliases",
            "definition",
            "term_id",
            "name",
            "first_letter",
            "type",
            "term_name_type",
            "pretty_url_name",
            "preferred_name"
        ]
    },
    "sort": [ { "name": {} } ],
    "query": {
        "bool": {
            "should": [
                {
                    "bool": {
                        "must": [
                            { "match": { "name._contain": { "query": "paclitaxel" } } },
                            { "term": { "type": { "value": "DrugTerm" } } }
                        ]
                    }
                },
                {
                    "nested": {
                        "query": { "match": { "alias.name._contain": { "query": "paclitaxel" } } },
                        "path": "aliases"
                    }
                }
            ]
        }
    }
    }

What's the expected result?

What's the actual result?

blairlearn commented 4 years ago

Oh for crying out loud.... It's a typo. in the nested portion.

{
    "nested": {
        "query": { "match": { "alias.name._contain": { "query": "paclitaxel" } } },
        "path": "aliases"
    }
}

The match should be for aliases not alias.