Commit d807de52 authored by Alexandre Delanoë's avatar Alexandre Delanoë

[FIX] Search in abstrct

MR: gargantext/haskell-gargantext!53
parent bb79271d
......@@ -360,12 +360,21 @@ viewDocumentsQuery cId t ntId mQuery = proc () -> do
restrict -< c^.cs_typename .== (sqlInt4 ntId)
restrict -< if t then nc^.nc_category .== (sqlInt4 0)
else nc^.nc_category .>= (sqlInt4 1)
let query = (fromMaybe "" mQuery)
restrict -< if query == ""
then sqlBool True
else (c^.cs_search) @@ (plaintoTSQuery $ T.unpack query)
let
query = (fromMaybe "" mQuery)
iLikeQuery = T.intercalate "" ["%", query, "%"]
abstractLHS h = fromNullable (sqlStrictText "")
$ toNullable h .->> (sqlStrictText "abstract")
restrict -<
if query == "" then sqlBool True
else ((c^.cs_name) `ilike` (sqlStrictText iLikeQuery))
.|| ((abstractLHS (c^.cs_hyperdata)) `ilike` (sqlStrictText iLikeQuery))
returnA -< (c, nc)
------------------------------------------------------------------------
filterWith :: (SqlOrd date, SqlOrd title, SqlOrd category, SqlOrd score, hyperdata ~ Column SqlJsonb) =>
Maybe Gargantext.Core.Types.Offset
......
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