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

[FIX] Search in abstrct

MR: !53
parent bb79271d
...@@ -360,12 +360,21 @@ viewDocumentsQuery cId t ntId mQuery = proc () -> do ...@@ -360,12 +360,21 @@ viewDocumentsQuery cId t ntId mQuery = proc () -> do
restrict -< c^.cs_typename .== (sqlInt4 ntId) restrict -< c^.cs_typename .== (sqlInt4 ntId)
restrict -< if t then nc^.nc_category .== (sqlInt4 0) restrict -< if t then nc^.nc_category .== (sqlInt4 0)
else nc^.nc_category .>= (sqlInt4 1) else nc^.nc_category .>= (sqlInt4 1)
let query = (fromMaybe "" mQuery)
restrict -< if query == "" let
then sqlBool True query = (fromMaybe "" mQuery)
else (c^.cs_search) @@ (plaintoTSQuery $ T.unpack query) 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) returnA -< (c, nc)
------------------------------------------------------------------------ ------------------------------------------------------------------------
filterWith :: (SqlOrd date, SqlOrd title, SqlOrd category, SqlOrd score, hyperdata ~ Column SqlJsonb) => filterWith :: (SqlOrd date, SqlOrd title, SqlOrd category, SqlOrd score, hyperdata ~ Column SqlJsonb) =>
Maybe Gargantext.Core.Types.Offset 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