diff --git a/src/clojars/admin.clj b/src/clojars/admin.clj index ff369f04..383ddcc6 100644 --- a/src/clojars/admin.clj +++ b/src/clojars/admin.clj @@ -1,6 +1,7 @@ (ns clojars.admin (:require [clojars.config :refer [config]] [clojars.db :as db] + [clojars.search :as search] [clojure.java.io :as io] [clojure.string :as str] [clojure.tools.nrepl.server :as nrepl]) @@ -40,7 +41,8 @@ (println "Deleting" group-id) (repo->backup [group-id]) (db/delete-jars group-id) - (db/delete-groups group-id))) + (db/delete-groups group-id) + (search/delete-from-index group-id))) (println "No group found under" group-id))) (defn delete-jars [group-id jar-id & [version]] @@ -56,7 +58,8 @@ (fn [] (println "Deleting" pretty-coords) (repo->backup [group-id jar-id version]) - (apply db/delete-jars group-id jar-id (if version [version] [])))) + (apply db/delete-jars group-id jar-id (if version [version] [])) + (search/delete-from-index group-id jar-id))) (println "No artifacts found under" group-id jar-id version)))) (defn init [] diff --git a/src/clojars/search.clj b/src/clojars/search.clj index 046128da..bab6262f 100644 --- a/src/clojars/search.clj +++ b/src/clojars/search.clj @@ -35,6 +35,12 @@ (def renames {:name :artifact-id :group :group-id}) +(defn delete-from-index [group-id & [artifact-id]] + (with-open [index (clucy/disk-index (config :index-path))] + (clucy/search-and-delete index + (cond-> (str "group-id:" group-id) + artifact-id (str " AND artifact-id:" artifact-id))))) + (defn index-pom [index pom-file] (let [pom (-> (mvn/pom-to-map pom-file) (set/rename-keys renames)