Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
haskell-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Przemyslaw Kaminski
haskell-gargantext
Commits
cd11bf35
Commit
cd11bf35
authored
Oct 19, 2018
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FIX] Text Search Type and documentation.
parent
056eb027
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
8 deletions
+10
-8
NodeNode.hs
src/Gargantext/Database/NodeNode.hs
+1
-1
TextSearch.hs
src/Gargantext/Database/TextSearch.hs
+9
-7
No files found.
src/Gargantext/Database/NodeNode.hs
View file @
cd11bf35
...
...
@@ -16,7 +16,7 @@ commentary with @some markup@.
{-# LANGUAGE Arrows #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE QuasiQuotes
#-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE TemplateHaskell #-}
...
...
src/Gargantext/Database/TextSearch.hs
View file @
cd11bf35
...
...
@@ -27,7 +27,7 @@ import Data.Text (Text, words)
import
Database.PostgreSQL.Simple
import
Database.PostgreSQL.Simple.ToField
import
Gargantext.Database.
Utils
(
connectGargandb
)
import
Gargantext.Database.
Node
(
Cmd
(
..
),
mkCmd
,
CorpusId
,
DocId
)
import
Gargantext.Prelude
newtype
TSQuery
=
UnsafeTSQuery
[
Text
]
...
...
@@ -74,18 +74,20 @@ textSearchQuery = "SELECT n.id, n.hyperdata->'publication_year' \
\
FROM nodes n
\
\
LEFT JOIN nodes_nodes nn ON nn.node2_id = n.id
\
\
WHERE
\
\
n.search @@ (?::tsquery)
\
\
AND n.parent_id = ? AND n.typename = 4
0
\
\
n.search @@ (?::tsquery)
\
\
AND n.parent_id = ? AND n.typename = 4
\
\
ORDER BY n.hyperdata -> 'publication_date' ?
\
\
offset ? limit ?;"
-- | Text Search Function for Master Corpus
-- TODO : text search for user corpus
-- Example:
-- textSearchTest :: ParentId -> TSQuery -> Cmd [(Int, Value, Value, Value, Value, Maybe Int)]
-- textSearchTest pId q = mkCmd $ \c -> textSearch c q pId 5 0 Asc
textSearch
::
Connection
->
TSQuery
->
ParentId
->
Limit
->
Offset
->
Order
->
IO
[(
Int
,
Value
,
Value
,
Value
,
Value
,
Maybe
Int
)]
textSearch
conn
q
p
l
o
ord
=
query
conn
textSearchQuery
(
q
,
p
,
ord
,
o
,
l
)
textSearchTest
::
ParentId
->
TSQuery
->
IO
()
textSearchTest
pId
q
=
connectGargandb
"gargantext.ini"
>>=
\
conn
->
textSearch
conn
q
pId
5
0
Asc
>>=
mapM_
print
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment