Commit b3109276 authored by Przemyslaw Kaminski's avatar Przemyslaw Kaminski

[ngrams] make ngrams search case-insensitive

parent afe1bf6d
...@@ -94,7 +94,7 @@ import Data.Monoid ...@@ -94,7 +94,7 @@ import Data.Monoid
import Data.Ord (Down(..)) import Data.Ord (Down(..))
import Data.Patch.Class (Action(act), Transformable(..), ours) import Data.Patch.Class (Action(act), Transformable(..), ours)
import Data.Swagger hiding (version, patch) import Data.Swagger hiding (version, patch)
import Data.Text (Text, isInfixOf, unpack, pack) import Data.Text (Text, isInfixOf, toLower, unpack, pack)
import Data.Text.Lazy.IO as DTL import Data.Text.Lazy.IO as DTL
import Formatting (hprint, int, (%)) import Formatting (hprint, int, (%))
import GHC.Generics (Generic) import GHC.Generics (Generic)
...@@ -783,7 +783,7 @@ getTableNgramsCorpus :: (HasNodeStory env err m, HasNodeError err, HasConnection ...@@ -783,7 +783,7 @@ getTableNgramsCorpus :: (HasNodeStory env err m, HasNodeError err, HasConnection
getTableNgramsCorpus nId tabType listId limit_ offset listType minSize maxSize orderBy mt = getTableNgramsCorpus nId tabType listId limit_ offset listType minSize maxSize orderBy mt =
getTableNgrams NodeCorpus nId tabType listId limit_ offset listType minSize maxSize orderBy searchQuery getTableNgrams NodeCorpus nId tabType listId limit_ offset listType minSize maxSize orderBy searchQuery
where where
searchQuery (NgramsTerm nt) = maybe (const True) isInfixOf mt nt searchQuery (NgramsTerm nt) = maybe (const True) isInfixOf (toLower <$> mt) (toLower nt)
......
...@@ -178,4 +178,3 @@ getPair cId ft o l order = ...@@ -178,4 +178,3 @@ getPair cId ft o l order =
(Just Docs) -> runViewAuthorsDoc cId False o l order (Just Docs) -> runViewAuthorsDoc cId False o l order
(Just Trash) -> runViewAuthorsDoc cId True o l order (Just Trash) -> runViewAuthorsDoc cId True o l order
_ -> panic $ "not implemented: get Pairing" <> (cs $ show ft) _ -> panic $ "not implemented: get Pairing" <> (cs $ show ft)
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