From 046238a5fe7c581885769dccf1f47d3f781a642a Mon Sep 17 00:00:00 2001 From: Nestor Carvantes Date: Wed, 28 Apr 2021 11:47:06 -0700 Subject: [PATCH] fix: token search params were matching additional documents (#65) --- src/QueryBuilder/typeQueries/tokenQuery.test.ts | 4 ---- src/QueryBuilder/typeQueries/tokenQuery.ts | 3 +-- src/__snapshots__/elasticSearchService.test.ts.snap | 11 ----------- 3 files changed, 1 insertion(+), 17 deletions(-) diff --git a/src/QueryBuilder/typeQueries/tokenQuery.test.ts b/src/QueryBuilder/typeQueries/tokenQuery.test.ts index 3ae90b9..561f21b 100644 --- a/src/QueryBuilder/typeQueries/tokenQuery.test.ts +++ b/src/QueryBuilder/typeQueries/tokenQuery.test.ts @@ -101,7 +101,6 @@ describe('tokenQuery', () => { "identifier.code.keyword", "identifier.coding.code.keyword", "identifier.value.keyword", - "identifier.value", "identifier", ], "lenient": true, @@ -121,7 +120,6 @@ describe('tokenQuery', () => { "identifier.code.keyword", "identifier.coding.code.keyword", "identifier.value.keyword", - "identifier.value", "identifier", ], "lenient": true, @@ -141,7 +139,6 @@ describe('tokenQuery', () => { "identifier.code.keyword", "identifier.coding.code.keyword", "identifier.value.keyword", - "identifier.value", "identifier", ], "lenient": true, @@ -183,7 +180,6 @@ describe('tokenQuery', () => { "identifier.code.keyword", "identifier.coding.code.keyword", "identifier.value.keyword", - "identifier.value", "identifier", ], "lenient": true, diff --git a/src/QueryBuilder/typeQueries/tokenQuery.ts b/src/QueryBuilder/typeQueries/tokenQuery.ts index 4a17196..ff8a1f0 100644 --- a/src/QueryBuilder/typeQueries/tokenQuery.ts +++ b/src/QueryBuilder/typeQueries/tokenQuery.ts @@ -67,8 +67,7 @@ export function tokenQuery(compiled: CompiledSearchParam, value: string): any { const fields = [ `${compiled.path}.code.keyword`, // Coding `${compiled.path}.coding.code.keyword`, // CodeableConcept - `${compiled.path}.value.keyword`, // Identifier - `${compiled.path}.value`, // ContactPoint + `${compiled.path}.value.keyword`, // Identifier, ContactPoint `${compiled.path}`, // code, boolean, uri, string ]; diff --git a/src/__snapshots__/elasticSearchService.test.ts.snap b/src/__snapshots__/elasticSearchService.test.ts.snap index f91ead9..9c4179c 100644 --- a/src/__snapshots__/elasticSearchService.test.ts.snap +++ b/src/__snapshots__/elasticSearchService.test.ts.snap @@ -1424,7 +1424,6 @@ Array [ "id.code.keyword", "id.coding.code.keyword", "id.value.keyword", - "id.value", "id", ], "lenient": true, @@ -1437,7 +1436,6 @@ Array [ "gender.code.keyword", "gender.coding.code.keyword", "gender.value.keyword", - "gender.value", "gender", ], "lenient": true, @@ -1553,7 +1551,6 @@ Array [ "id.code.keyword", "id.coding.code.keyword", "id.value.keyword", - "id.value", "id", ], "lenient": true, @@ -1593,7 +1590,6 @@ Array [ "gender.code.keyword", "gender.coding.code.keyword", "gender.value.keyword", - "gender.value", "gender", ], "lenient": true, @@ -1653,7 +1649,6 @@ Array [ "gender.code.keyword", "gender.coding.code.keyword", "gender.value.keyword", - "gender.value", "gender", ], "lenient": true, @@ -1679,7 +1674,6 @@ Array [ "identifier.code.keyword", "identifier.coding.code.keyword", "identifier.value.keyword", - "identifier.value", "identifier", ], "lenient": true, @@ -1722,7 +1716,6 @@ Array [ "gender.code.keyword", "gender.coding.code.keyword", "gender.value.keyword", - "gender.value", "gender", ], "lenient": true, @@ -1772,7 +1765,6 @@ Array [ "gender.code.keyword", "gender.coding.code.keyword", "gender.value.keyword", - "gender.value", "gender", ], "lenient": true, @@ -1852,7 +1844,6 @@ Array [ "id.code.keyword", "id.coding.code.keyword", "id.value.keyword", - "id.value", "id", ], "lenient": true, @@ -1865,7 +1856,6 @@ Array [ "gender.code.keyword", "gender.coding.code.keyword", "gender.value.keyword", - "gender.value", "gender", ], "lenient": true, @@ -1991,7 +1981,6 @@ Array [ "telecom.code.keyword", "telecom.coding.code.keyword", "telecom.value.keyword", - "telecom.value", "telecom", ], "lenient": true,