nub media search results

This commit is contained in:
nek0 2017-10-21 19:10:53 +02:00
parent ed3553eb13
commit 80274e0db2
2 changed files with 3 additions and 3 deletions

View file

@ -20,7 +20,7 @@ import Import
import qualified Data.Text as T import qualified Data.Text as T
import Data.Maybe (fromJust) import Data.Maybe (fromJust)
import Data.List (sortBy) import Data.List (sortBy, nub)
import Database.Persist.Sql (rawSql) import Database.Persist.Sql (rawSql)
@ -37,7 +37,7 @@ getSearchR = do
[PersistText query] [PersistText query]
b <- rawSql "select ?? from medium where ? % any(string_to_array(description, ' '))" b <- rawSql "select ?? from medium where ? % any(string_to_array(description, ' '))"
[PersistText query] [PersistText query]
return $ sortBy (\ sa sb -> compare return $ nub $ sortBy (\ sa sb -> compare
(T.unpack $ mediumTitle $ entityVal sa) (T.unpack $ mediumTitle $ entityVal sa)
(T.unpack $ mediumTitle $ entityVal sb)) (T.unpack $ mediumTitle $ entityVal sb))
$ a ++ b $ a ++ b

View file

@ -1,5 +1,5 @@
name: eidolon name: eidolon
version: 0.1.11.4 version: 0.1.11.5
synopsis: Image gallery in Yesod synopsis: Image gallery in Yesod
homepage: https://eidolon.nek0.eu homepage: https://eidolon.nek0.eu
license: AGPL-3 license: AGPL-3