Skip to content

cts.query builder #562

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ehennum opened this issue Feb 2, 2021 · 1 comment
Closed

cts.query builder #562

ehennum opened this issue Feb 2, 2021 · 1 comment
Assignees
Milestone

Comments

@ehennum
Copy link
Contributor

ehennum commented Feb 2, 2021

Similar to the Java API, reuse the cts.query builder included with the Optic builder for search requests.

@ehennum
Copy link
Contributor Author

ehennum commented Mar 12, 2021

The Java equivalent:

Something along the following lines should work:

  • In lib/plan-builder-base.js, add the existing exportArg function to the exports
  • Add a new lib/ctsquery-builder.js module
  • Start with the copyright comment and strict pragma
  • Import bldrgen = require('./plan-builder-generated.js')
  • Define a CtsQueryBuilder class
  • In the constructor, set the documented fn, geo, json, map, math, rdf, sem, spell, sql, xdmp, and xs fields to new bldrgen CtsExpr, FnExpr, GeoExpr, JsonExpr, MapExpr, MathExpr, RdfExpr, SemExpr, SpellExpr, SqlExpr, XdmpExpr, and XsExpr objects
  • Export a builder object that's an instance of the CtsQueryBuilder class
  • In query-builder.js, import bldrbase = require('./plan-builder-base.js')
  • Import types = require('./server-types-generated.js')
  • Modify the where() function to add a case that tests arg instanceof types.CtsQuery similar to the existing case for arg.$query != null that sets self.whereClause to arg and self.queryType to 'cts'
  • Modify the makeSearchBody() function in query-builder.js to add a case for builtQuery.queryType === 'cts' similar to the existing case for builtQuery.queryType === 'qbe' that set the search.ctsast property to the result of bldrbase.exportArg(whereClause)
  • Add a ctsQueryBuilder field to the export object for marklogic.js
  • Add tests to documents-query.js that uses the ctsQueryBuilder to construct a query and pass it to queryBuilder.where()

anu3990 added a commit to anu3990/node-client-api that referenced this issue Mar 18, 2021
anu3990 added a commit that referenced this issue Mar 18, 2021
@anu3990 anu3990 added test and removed new labels Mar 18, 2021
@anu3990 anu3990 added this to the 2.7-NEXT milestone Jun 8, 2021
georgeajit pushed a commit that referenced this issue Jun 29, 2021
georgeajit pushed a commit that referenced this issue Jun 29, 2021
@georgeajit georgeajit removed the test label Jun 29, 2021
@anu3990 anu3990 added the ship label Feb 15, 2022
@anu3990 anu3990 closed this as completed Feb 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants