Skip to content

Commit

Permalink
fixes #78 - sort search results by indegree
Browse files Browse the repository at this point in the history
  • Loading branch information
simongray committed Nov 1, 2023
1 parent 3b23f9c commit 1743e9a
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions src/main/dk/cst/dannet/db/search.clj
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,6 @@
{?ontotype ?label})
(apply merge-with q/set-merge)))))))

(def search-keyfn
(let [m->label (fn [{:keys [rdf/value] :as m}]
(str (get (:k->label (meta m)) value)))]
(comp (juxt (comp count m->label)
(comp m->label)
(comp str :skos/definition)
(comp :rdf/value))
second)))

;; TODO: need to also numerically order by synset key, not just alphabetically
(defn look-up
"Look up synsets in Graph `g` based on the given `lemma`."
Expand All @@ -57,7 +48,7 @@
{:k->label (assoc k->label
?synset ?label)})]
[k v])))
(sort-by search-keyfn)
(sort-by (comp - #(get @q/synset-indegrees % 0) first))
(into (fop/ordered-map)))))

(comment
Expand Down

0 comments on commit 1743e9a

Please sign in to comment.