Skip to content

Query endpoint

OrdiNeu edited this page Feb 6, 2020 · 2 revisions

Querying data

You can form data queries at /Query, which requires one of the following four parameters

  • query, when given a JCR-SQL2 query, returns all nodes returned by that query. The specifications can be found here, but this link may be easier to read.
  • lucene, when given a lucene query, returns all nodes returned by that query. This query is restricted to only search through LFS-specific nodes.
  • fulltext, when given a chunk of text, returns all nodes containing the given text. More information about full-text queries can be found here.
  • quick, when given a chunk of text, returns all lfs:Form, lfs:Questionnaire, and lfs:Subject nodes whose children contain the given text. For instance, /query?quick=alive will return all forms that contain an answer with the text "alive"

It also takes the following optional parameters:

  • doNotEscapeQuery (default: false) whether or not SQL operators (e.g. ||) should be escaped in quick and fulltext queries. A full list of escaped characters can be found here, although please note that the escaping of single quotes ' cannot be disabled.
  • limit (default: 10) The number of results to return
  • offset (default: 0) How many entries past the first to skip. Meant to be used in conjunction with limit to paginate the results.
  • req An ID, which will be appended to the output. This can be used to differentiate between multiple simultaneous requests to /query.

This will return a JSON object, with the following parameters:

  • rows An array the returned nodes as JSON objects. Dereferencing is not performed, but this will include the children of the JSON objects as well.
  • req The input ID
  • offset The offset
  • limit The limit of results
  • returnedrows The number of rows returned
  • totalrows The total number of rows that the query matched