]> Git — Sourcephile - gargantext.git/blob - src/Gargantext/Database/Action/Index.hs
[GQL] Remove TODO
[gargantext.git] / src / Gargantext / Database / Action / Index.hs
1 {-|
2 Module : Gargantext.Database.Action.Index
3 Description : Indexation tools
4 Copyright : (c) CNRS, 2017-Present
5 License : AGPL + CECILL v3
6 Maintainer : team@gargantext.org
7 Stability : experimental
8 Portability : POSIX
9
10 Main Database functions for Gargantext.API.Node.Update
11
12 UpdateNodeParamsTexts { methodTexts :: Granularity }
13 data Granularity = NewNgrams | NewTexts | Both
14 deriving (Generic, Eq, Ord, Enum, Bounded)
15
16 -- TODO add option for type of ngrams
17
18 -}
19
20 module Gargantext.Database.Action.Index
21 where
22
23 {-
24 import Data.List (nub)
25 import Gargantext.Core.Text.Terms.WithList (buildPatterns, filterTerms, termsInText)
26
27
28 index :: CorpusId -> Granularity -> Cmd err [Int]
29 index cId NewNgrams = do
30 ngrams <- get ngrams with zero count
31 texts <- get all text to index
32 indexSave text (buildPatterns ngrams)
33
34 index cId NewTexts = do
35 ngrams <- get all ngrams
36 texts <- get text with zero count
37 indexSave text (buildPatterns ngrams)
38
39 index cId Both = do
40 r1 <- index cId NewNgrams
41 r2 <- index cId NewTexts
42 pure $ r1 <> r2
43
44 indexSave :: [Document] -> Pattern -> Cmd err [Int]
45 indexSave corpus p = do
46 indexedDoc <- map (filterTerms patterns) corpus
47 saveIndexDoc ngramsTextId
48 -}
49
50
51
52
53