<commit_before>(ns cmr.search.system
  (:require [cmr.common.lifecycle :as lifecycle]
            [cmr.common.log :as log :refer (debug info warn error)]
            [cmr.common.api.web-server :as web]
            [cmr.common.cache :as cache]
            [cmr.search.api.routes :as routes]
            [cmr.search.data.elastic-search-index :as idx]
            [cmr.system-trace.context :as context]
            [cmr.metadata-db.system :as mdb-system]
            [cmr.common.config :as cfg]
            [cmr.transmit.config :as transmit-config]
            [cmr.elastic-utils.config :as es-config]))

;; Design based on http://stuartsierra.com/2013/09/15/lifecycle-composition and related posts

(def search-public-protocol (cfg/config-value :search-public-protocol "http"))
(def search-public-host (cfg/config-value :search-public-host "localhost"))
(def search-public-port (cfg/config-value :search-public-port 3003 transmit-config/parse-port))
(def search-relative-root-url (cfg/config-value :search-relative-root-url ""))

(def search-public-conf
  {:protocol search-public-protocol
   :host search-public-host
   :port search-public-port
   :relative-root-url search-relative-root-url})

(def
  ^{:doc "Defines the order to start the components."
    :private true}
  component-order [:log :search-index :web])

(defn create-system
  "Returns a new instance of the whole application."
  []
  (let [metadata-db (-> (mdb-system/create-system "metadata-db-in-search-app-pool")
                        (dissoc :log :web)
                        (assoc :skip-background-jobs true))
        sys {:log (log/create-logger)

             ;; An embedded version of the metadata db app to allow quick retrieval of data<commit_msg>Updating for metadata db system changes.<commit_after>(ns cmr.search.system
  (:require [cmr.common.lifecycle :as lifecycle]
            [cmr.common.log :as log :refer (debug info warn error)]
            [cmr.common.api.web-server :as web]
            [cmr.common.cache :as cache]
            [cmr.search.api.routes :as routes]
            [cmr.search.data.elastic-search-index :as idx]
            [cmr.system-trace.context :as context]
            [cmr.metadata-db.system :as mdb-system]
            [cmr.common.config :as cfg]
            [cmr.transmit.config :as transmit-config]
            [cmr.elastic-utils.config :as es-config]))

;; Design based on http://stuartsierra.com/2013/09/15/lifecycle-composition and related posts

(def search-public-protocol (cfg/config-value :search-public-protocol "http"))
(def search-public-host (cfg/config-value :search-public-host "localhost"))
(def search-public-port (cfg/config-value :search-public-port 3003 transmit-config/parse-port))
(def search-relative-root-url (cfg/config-value :search-relative-root-url ""))

(def search-public-conf
  {:protocol search-public-protocol
   :host search-public-host
   :port search-public-port
   :relative-root-url search-relative-root-url})

(def
  ^{:doc "Defines the order to start the components."
    :private true}
  component-order [:log :search-index :web])

(defn create-system
  "Returns a new instance of the whole application."
  []
  (let [metadata-db (-> (mdb-system/create-system "metadata-db-in-search-app-pool")
                        (dissoc :log :web :scheduler))
        sys {:log (log/create-logger)

             ;; An embedded version of the metadata db app to allow quick retrieval of data
{'fraction_non_alphanumeric': 0.131525226013415, 'fraction_numerical': 0.00699912510936133, 'mean_word_length': 2.806881243063263, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '631755', 'n_tokens_mistral': 1087, 'n_tokens_neox': 1052, 'n_words': 262}