From 80274e0db201a87945dace40eb531a30d53da21b Mon Sep 17 00:00:00 2001 From: nek0 Date: Sat, 21 Oct 2017 19:10:53 +0200 Subject: [PATCH] nub media search results --- Handler/Search.hs | 4 ++-- eidolon.cabal | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Handler/Search.hs b/Handler/Search.hs index 23efc89..1b09a48 100755 --- a/Handler/Search.hs +++ b/Handler/Search.hs @@ -20,7 +20,7 @@ import Import import qualified Data.Text as T import Data.Maybe (fromJust) -import Data.List (sortBy) +import Data.List (sortBy, nub) import Database.Persist.Sql (rawSql) @@ -37,7 +37,7 @@ getSearchR = do [PersistText query] b <- rawSql "select ?? from medium where ? % any(string_to_array(description, ' '))" [PersistText query] - return $ sortBy (\ sa sb -> compare + return $ nub $ sortBy (\ sa sb -> compare (T.unpack $ mediumTitle $ entityVal sa) (T.unpack $ mediumTitle $ entityVal sb)) $ a ++ b diff --git a/eidolon.cabal b/eidolon.cabal index 1d0c5c5..c07da65 100755 --- a/eidolon.cabal +++ b/eidolon.cabal @@ -1,5 +1,5 @@ name: eidolon -version: 0.1.11.4 +version: 0.1.11.5 synopsis: Image gallery in Yesod homepage: https://eidolon.nek0.eu license: AGPL-3