<commit_before>(ns wb-es.web.index
  (:require [compojure.core :refer :all]
            [compojure.route :as route]
            [ring.middleware.defaults :refer [wrap-defaults api-defaults]]
            [ring.middleware.json :refer [wrap-json-response]]
            [ring.util.response :refer [response not-found]]
            [wb-es.env :refer [es-base-url release-id]]
            [wb-es.web.core :as web-core]
            [wb-es.web.integration :as web-integration]))

(def search-route
  (GET "/search" [q & options]
       (response (web-core/search es-base-url release-id q options))))

(def autocomplete-route
  (GET "/autocomplete" [q & options]
       (response (web-core/autocomplete es-base-url release-id q options))))

(def search-exact-route
  (GET "/search-exact" [q & options]
       (response (web-core/search-exact es-base-url release-id q options))))

(def count-route
  (GET "/count" [q & options]
       (response (web-core/count es-base-url release-id q options))))

(def random-route
  (GET "/random" [q & options]
       (response (web-core/random es-base-url release-id options))))

(def api-lite-routes<commit_msg>allow index to be set by things other than relase id<commit_after>(ns wb-es.web.index
  (:require [compojure.core :refer :all]
            [compojure.route :as route]
            [ring.middleware.defaults :refer [wrap-defaults api-defaults]]
            [ring.middleware.json :refer [wrap-json-response]]
            [ring.util.response :refer [response not-found]]
            [wb-es.env :refer [es-base-url release-id]]
            [wb-es.web.core :as web-core]
            [wb-es.web.integration :as web-integration]))

(def index-id release-id)

(def search-route
  (GET "/search" [q & options]
       (response (web-core/search es-base-url index-id q options))))

(def autocomplete-route
  (GET "/autocomplete" [q & options]
       (response (web-core/autocomplete es-base-url index-id q options))))

(def search-exact-route
  (GET "/search-exact" [q & options]
       (response (web-core/search-exact es-base-url index-id q options))))

(def count-route
  (GET "/count" [q & options]
       (response (web-core/count es-base-url index-id q options))))

(def random-route
  (GET "/random" [q & options]
       (response (web-core/random es-base-url index-id options))))

(def api-lite-routes
{'fraction_non_alphanumeric': 0.1523972602739726, 'fraction_numerical': 0.0, 'mean_word_length': 2.775444264943457, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1272600', 'n_tokens_mistral': 779, 'n_tokens_neox': 766, 'n_words': 194}