Fix Search URL

parent c36a8b8b
...@@ -40,10 +40,6 @@ import React.DOM (a, br', button, div, i, input, p, text) ...@@ -40,10 +40,6 @@ import React.DOM (a, br', button, div, i, input, p, text)
import React.DOM.Props (_type, className, href, onClick, placeholder, style, checked, target) import React.DOM.Props (_type, className, href, onClick, placeholder, style, checked, target)
import Thermite (PerformAction, Render, Spec, defaultPerformAction, modifyState_, simpleSpec, hideState) import Thermite (PerformAction, Render, Spec, defaultPerformAction, modifyState_, simpleSpec, hideState)
------------------------------------------------------------------------ ------------------------------------------------------------------------
-- TODO: Search is pending
-- TODO: Fav is pending
-- TODO: Sort is Pending
-- TODO: Filter is Pending
type NodeID = Int type NodeID = Int
type TotalRecords = Int type TotalRecords = Int
......
...@@ -36,10 +36,6 @@ import React.DOM (a, br', button, div, i, input, p, text, span) ...@@ -36,10 +36,6 @@ import React.DOM (a, br', button, div, i, input, p, text, span)
import React.DOM.Props (_type, className, href, onClick, placeholder, style, checked, target) import React.DOM.Props (_type, className, href, onClick, placeholder, style, checked, target)
import Thermite (PerformAction, Render, Spec, defaultPerformAction, modifyState_, simpleSpec, hideState) import Thermite (PerformAction, Render, Spec, defaultPerformAction, modifyState_, simpleSpec, hideState)
------------------------------------------------------------------------ ------------------------------------------------------------------------
-- TODO: Search is pending
-- TODO: Fav is pending
-- TODO: Sort is Pending
-- TODO: Filter is Pending
type NodeID = Int type NodeID = Int
type TotalRecords = Int type TotalRecords = Int
...@@ -297,7 +293,7 @@ initialPageParams {nodeId, query} = {nodeId, query, params: T.initialParams} ...@@ -297,7 +293,7 @@ initialPageParams {nodeId, query} = {nodeId, query, params: T.initialParams}
loadPage :: PageParams -> Aff (Array DocumentsView) loadPage :: PageParams -> Aff (Array DocumentsView)
loadPage {nodeId, query, params: {limit, offset, orderBy}} = do loadPage {nodeId, query, params: {limit, offset, orderBy}} = do
logs "loading documents page: loadPage with Offset and limit" logs "loading documents page: loadPage with Offset and limit"
let url = toUrl Back (Search { offset, limit, orderBy: convOrderBy <$> orderBy }) Nothing let url = toUrl Back (Search { offset, limit, orderBy: convOrderBy <$> orderBy }) (Just nodeId)
SearchResults res <- post url $ SearchQuery {id: nodeId, query} SearchResults res <- post url $ SearchQuery {id: nodeId, query}
pure $ res2corpus <$> res.results pure $ res2corpus <$> res.results
where where
......
...@@ -174,9 +174,11 @@ pathUrl c (PutNgrams t listid termList) i = ...@@ -174,9 +174,11 @@ pathUrl c (PutNgrams t listid termList) i =
pathUrl c Auth Nothing = c.prePath <> "auth" pathUrl c Auth Nothing = c.prePath <> "auth"
pathUrl c Auth (Just _) = "impossible" -- TODO better types pathUrl c Auth (Just _) = "impossible" -- TODO better types
pathUrl c (NodeAPI nt) i = c.prePath <> nodeTypeUrl nt <> (maybe "" (\i' -> "/" <> show i') i) pathUrl c (NodeAPI nt) i = c.prePath <> nodeTypeUrl nt <> (maybe "" (\i' -> "/" <> show i') i)
pathUrl c (Search {limit,offset,orderBy}) _TODO = pathUrl c (Search {limit,offset,orderBy}) i =
c.prePath <> "search/?dummy=dummy" pathUrl c (NodeAPI Corpus) i
<> offsetUrl offset <> limitUrl limit <> orderUrl orderBy <> "/search?dummy=dummy"
-- dummy is here just because offsetUrl starts with &...
<> offsetUrl offset <> limitUrl limit <> orderUrl orderBy
pathUrl c (CorpusMetrics {tabType, listId, limit}) i = pathUrl c (CorpusMetrics {tabType, listId, limit}) i =
pathUrl c (NodeAPI Corpus) i <> "/metrics" pathUrl c (NodeAPI Corpus) i <> "/metrics"
<> "?ngrams=" <> show listId <> "?ngrams=" <> show listId
......
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