Commit 2b2231cb authored by Alexandre Delanoë's avatar Alexandre Delanoë

[FIX] Graph Explorer search waiting for the search in docs with ngrams and our TFIDF

parent da954a33
......@@ -18,7 +18,7 @@ module Gargantext.API.Search
where
import Data.Aeson hiding (defaultTaggedObject)
import Data.List (concat)
-- import Data.List (concat)
import Data.Maybe (fromMaybe)
import Data.Swagger hiding (fieldLabelModifier, Contact)
import Data.Text (Text)
......@@ -56,7 +56,8 @@ api :: NodeId -> GargServer (API SearchResult)
api nId (SearchQuery q SearchDoc) o l order =
SearchResult <$> SearchResultDoc
<$> map (toRow nId)
<$> searchInCorpus nId False (concat q) o l order
<$> searchInCorpus nId False q o l order
-- <$> searchInCorpus nId False (concat q) o l order
api nId (SearchQuery q SearchContact) o l order = do
printDebug "isPairedWith" nId
......@@ -68,7 +69,7 @@ api nId (SearchQuery q SearchContact) o l order = do
Just aId -> SearchResult
<$> SearchResultContact
<$> map (toRow aId)
<$> searchInCorpusWithContacts nId aId (concat q) o l order
<$> searchInCorpusWithContacts nId aId q o l order
api _nId (SearchQuery _q SearchDocWithNgrams) _o _l _order = undefined
......@@ -88,7 +89,7 @@ instance Arbitrary SearchType where
-----------------------------------------------------------------------
data SearchQuery =
SearchQuery { query :: ![[Text]]
SearchQuery { query :: ![Text]
, expected :: !SearchType
}
deriving (Generic)
......@@ -103,7 +104,7 @@ instance ToSchema SearchQuery
-}
instance Arbitrary SearchQuery where
arbitrary = elements [SearchQuery [["electrodes"]] SearchDoc]
arbitrary = elements [SearchQuery ["electrodes"] SearchDoc]
-- arbitrary = elements [SearchQuery "electrodes" 1 ] --SearchDoc]
-----------------------------------------------------------------------
data SearchResult =
......
......@@ -58,7 +58,6 @@ searchDocInDatabase p t = runOpaQuery (queryDocInDatabase p t)
returnA -< (_ns_id row, _ns_hyperdata row)
------------------------------------------------------------------------
-- | Search ngrams in documents, ranking them by TF-IDF. We narrow our
-- search only to map/candidate terms.
searchInCorpusWithNgrams :: HasDBid NodeType
......
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