From a1b2c6ba70b54ab60958f6047c9feedae325075d Mon Sep 17 00:00:00 2001 From: Mark Wardle Date: Wed, 15 Mar 2023 18:05:07 +0000 Subject: [PATCH] Add max-hits parameter to expand-ecl --- src/com/eldrix/hermes/core.clj | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/com/eldrix/hermes/core.clj b/src/com/eldrix/hermes/core.clj index 2f337b15..23e88ca1 100644 --- a/src/com/eldrix/hermes/core.clj +++ b/src/com/eldrix/hermes/core.clj @@ -457,14 +457,18 @@ (search/do-search (.-searcher svc) params))) (s/fdef expand-ecl - :args (s/cat :svc ::svc :ecl ::non-blank-string) + :args (s/cat :svc ::svc :ecl ::non-blank-string :max-hits (s/? int?)) :ret (s/coll-of ::result)) (defn expand-ecl "Expand an ECL expression." - [^Svc svc ecl] - (let [q1 (ecl/parse svc ecl) - q2 (search/q-not q1 (search/q-fsn))] - (search/do-query-for-results (.-searcher svc) q2))) + ([^Svc svc ecl] + (let [q1 (ecl/parse svc ecl) + q2 (search/q-not q1 (search/q-fsn))] + (search/do-query-for-results (.-searcher svc) q2))) + ([^Svc svc ecl max-hits] + (let [q1 (ecl/parse svc ecl) + q2 (search/q-not q1 (search/q-fsn))] + (search/do-query-for-results (.-searcher svc) q2 max-hits)))) (s/fdef intersect-ecl :args (s/cat :svc ::svc :concept-ids (s/coll-of :info.snomed.Concept/id) :ecl ::non-blank-string))