Skip to content

Commit

Permalink
Limits searches that begin with HBM to an exact-match single entity r…
Browse files Browse the repository at this point in the history
…esponse
  • Loading branch information
BirdMachine committed Aug 29, 2023
1 parent 7e520c7 commit c89905b
Showing 1 changed file with 21 additions and 6 deletions.
27 changes: 21 additions & 6 deletions src/src/service/search_api.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,16 +153,31 @@ export function search_api_filter_es_query_builder(fields, from, size, colFields
}

if (fields["keywords"]) {
if (fields["keywords"] && fields["keywords"].indexOf("HBM") === 0) {
boolQuery.must(esb.matchQuery("hubmap_id", fields["keywords"] ));
// boolQuery.must(esb.matchQuery("hubmap_id", ("\"" +fields["keywords"]+ "\"" ) ));
} else {
boolQuery.filter(esb.multiMatchQuery(ES_SEARCHABLE_FIELDS, fields["keywords"]));
}
}
}
}
requestBody
.query(boolQuery)
.from(from)
.size(size)
.sort(esb.sort('last_modified_timestamp', 'asc'))
.source(colFields);
if (fields["keywords"] && fields["keywords"].indexOf("HBM") > -1) {
// console.debug('%c⊙', 'color:#00ff7b', "BOOLQUERY", boolQuery );
requestBody
.query(boolQuery)
.from(from)
.size(1)
.sort(esb.sort('last_modified_timestamp', 'asc'))
.source(colFields);
} else {
requestBody
.query(boolQuery)
.from(from)
.size(size)
.sort(esb.sort('last_modified_timestamp', 'asc'))
.source(colFields);
}
return requestBody.toJSON();

}
Expand Down

0 comments on commit c89905b

Please sign in to comment.