diff --git a/lib/controllers/v1/taxa_controller.js b/lib/controllers/v1/taxa_controller.js index abb976a3..ac64877f 100644 --- a/lib/controllers/v1/taxa_controller.js +++ b/lib/controllers/v1/taxa_controller.js @@ -635,6 +635,20 @@ TaxaController.search = async req => { } } ); searchReq.query.highlight.fields["names.name_autocomplete_ja"] = { }; + } else if ( params.exact === "true" ) { + filters.push( { + nested: { + path: "names", + query: { + match: { + "names.exact_ci": { + query: params.q + } + } + } + } + } ); + searchReq.query.highlight.fields["names.exact_ci"] = { }; } else { filters.push( { nested: { diff --git a/lib/views/swagger_v1.yml.ejs b/lib/views/swagger_v1.yml.ejs index 53a0b805..c239f6bd 100644 --- a/lib/views/swagger_v1.yml.ejs +++ b/lib/views/swagger_v1.yml.ejs @@ -1750,6 +1750,10 @@ paths: type: boolean in: query description: Taxon is `active` + - name: exact + type: boolean + in: query + description: If true, only return exact string matches - name: id type: array items: