Browse Source

Search server for json files

master
Maxim Likhachev 6 years ago committed by Maxim Likhachev
parent
commit
227ed22f15
  1. 21
      src/Search.hs
  2. 5
      src/Server.hs

21
src/Search.hs

@ -32,21 +32,22 @@ module Search (Json, tokenize, findJsonObjects) where @@ -32,21 +32,22 @@ module Search (Json, tokenize, findJsonObjects) where
-- -----------------------------------------------------------------------------
import Relude ( Maybe (Just, Nothing), Bool, Int, String, Text
, otherwise, sortWith, toString, toText, div
, (-), (*), ($), (&), (<$>), (==), (<>), (<), (>), (>=), (&&), (.) )
import Relude ( Maybe (Just, Nothing), Bool, Int, String, Text
, otherwise, sortWith, toString, toText, div
, (-), (*), (.), (<>), (==), (<), (>), (>=)
, ($), (&), (<$>), (&&) )
import Data.Aeson ( FromJSON, ToJSON, toJSON, object, (.=) )
import Data.Char ( toLower, isAlphaNum )
import Data.List ( minimum, map, sum, elem, filter, length, nub )
import GHC.Generics ( Generic )
import Text.EditDistance ( levenshteinDistance, defaultEditCosts )
import Data.Aeson ( FromJSON, ToJSON, toJSON, object, (.=) )
import Data.Char ( toLower, isAlphaNum )
import Data.List ( minimum, map, sum, elem, filter, length, nub )
import GHC.Generics ( Generic )
import Text.EditDistance ( levenshteinDistance, defaultEditCosts )
import qualified Data.Text as T ( map, length, take, toLower, strip, words )
import qualified Network.URI.Encode as URI ( decodeText )
import Settings ( maxContentLength, minPatternLength
, outOfScore, fullScore, scoreMultiplier, replaceChar )
import Settings ( maxContentLength, minPatternLength, replaceChar
, outOfScore, fullScore, scoreMultiplier )
-- -----------------------------------------------------------------------------

5
src/Server.hs

@ -37,10 +37,11 @@ import Relude ( Maybe (Just, Nothing), Stri @@ -37,10 +37,11 @@ import Relude ( Maybe (Just, Nothing), Stri
import Data.Aeson ( ToJSON, decodeFileStrict' )
import Web.Scotty ( ActionM, scotty, get, json, notFound, param, middleware, redirect )
import Network.Wai ( Middleware, Application, Request, Response, ResponseReceived, rawQueryString, rawPathInfo )
import Network.Wai.Middleware.RequestLogger.JSON ( formatAsJSON )
import Network.Wai ( Middleware, Application, Request, Response
, ResponseReceived, rawQueryString, rawPathInfo )
import Network.Wai.Middleware.RequestLogger ( logStdout, logStdoutDev, mkRequestLogger, outputFormat
, OutputFormat (CustomOutputFormat, CustomOutputFormatWithDetails) )
import Network.Wai.Middleware.RequestLogger.JSON ( formatAsJSON )
import Text.Pretty.Simple ( pPrint )
import Foreign.Marshal.Unsafe ( unsafeLocalState )

Loading…
Cancel
Save