Commit 78a2d87c authored by Przemyslaw Kaminski's avatar Przemyslaw Kaminski

[ngrams] add offline ordering by term

parent 72c5cdfa
...@@ -391,6 +391,8 @@ loadedNgramsTableSpec = Thermite.simpleSpec performAction render ...@@ -391,6 +391,8 @@ loadedNgramsTableSpec = Thermite.simpleSpec performAction render
case convOrderBy <$> params.orderBy of case convOrderBy <$> params.orderBy of
Just ScoreAsc -> A.sortWith \x -> (snd x) ^. _NgramsElement <<< _occurrences Just ScoreAsc -> A.sortWith \x -> (snd x) ^. _NgramsElement <<< _occurrences
Just ScoreDesc -> A.sortWith \x -> Down $ (snd x) ^. _NgramsElement <<< _occurrences Just ScoreDesc -> A.sortWith \x -> Down $ (snd x) ^. _NgramsElement <<< _occurrences
Just TermAsc -> A.sortWith \x -> (snd x) ^. _NgramsElement <<< _ngrams
Just TermDesc -> A.sortWith \x -> Down $ (snd x) ^. _NgramsElement <<< _ngrams
_ -> identity -- the server ordering is enough here _ -> identity -- the server ordering is enough here
rows :: T.Rows rows :: T.Rows
......
...@@ -180,14 +180,14 @@ _list = prop (SProxy :: SProxy "list") ...@@ -180,14 +180,14 @@ _list = prop (SProxy :: SProxy "list")
derive instance newtypeNgramsElement :: Newtype NgramsElement _ derive instance newtypeNgramsElement :: Newtype NgramsElement _
_NgramsElement :: Iso' NgramsElement { _NgramsElement :: Iso' NgramsElement {
children :: Set NgramsTerm children :: Set NgramsTerm
, list :: TermList , list :: TermList
, ngrams :: NgramsTerm , ngrams :: NgramsTerm
, occurrences :: Int , occurrences :: Int
, parent :: Maybe NgramsTerm , parent :: Maybe NgramsTerm
, root :: Maybe NgramsTerm , root :: Maybe NgramsTerm
} }
_NgramsElement = _Newtype _NgramsElement = _Newtype
instance decodeJsonNgramsElement :: DecodeJson NgramsElement where instance decodeJsonNgramsElement :: DecodeJson NgramsElement where
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment