Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

To query large outputs or large number of fragments across all anchors, we need to provide pagination for Query API( query data nodes across all anchors). it will help client to fetch limited set of data per request. below is two possible solutions for further discussions to decide appropriate choice.   

Pagination over fragments 

...

QueryDescriptionDecision 
SELECT id, anchor_id AS anchorId, xpath, parent_id AS parentId, CAST(attributes AS TEXT) AS attributes FROM FRAGMENT WHERE xpath ~ :xpathRegex ORDERED BY id LIMIT :pageSize OFFSET OFFSET  (:pageIndex + - 1) * :pageSize Query limited fragments in order of fragment id



...

ParameterisRequiredDescription
cps-pathyesnode path to be queried
descendantsnoNumber of descendants to be queried. default is none
pageIndexnopage index starting from 1. 
anchorSizenonumber of anchors per page starting from 1 (TBD). 

Query:

QueryDescriptionDecision
SELECT
anchor_
id FROM anchor
ordered
order by
anchor_
id LIMIT : anchorSize OFFSET : (pageIndex
+
-1) * :anchorSize query number of anchors to query from fragment table
SELECT id, anchor_id AS anchorId, xpath, parent_id AS parentId, CAST(attributes AS TEXT) AS attributes FROM FRAGMENT WHERE anchor_id IN :anchorList AND xpath ~ :xpathRegexquery fragments for list of anchors from above query