Skip to content
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

Support for cts:annotation in cts:query? #1648

Open
ralfhergert opened this issue Mar 22, 2024 · 3 comments
Open

Support for cts:annotation in cts:query? #1648

ralfhergert opened this issue Mar 22, 2024 · 3 comments

Comments

@ralfhergert
Copy link

CtsQueries allow to be enriched with cts:annotation-elements: https://docs.marklogic.com/guide/search-dev/cts_query#id_28038
Those elements are ignored by MarkLogic when the query is executed. cts:annotations can be used for various purposes (like documentation) and in our case we use it as a marker-element to identify certain parts of the query to be able to modify and manipulate them later after the creation.

Do the QueryBuilders support to add annotation-elements? (I searched, but didn't find it yet.)

@rjrudin
Copy link
Contributor

rjrudin commented Mar 22, 2024

Correct, there's not support for adding annotation elements. What's your use case for them? Like would you eventually serialize the query to a place where a developer / user would see it?

@ralfhergert
Copy link
Author

ralfhergert commented Mar 22, 2024

Hi @rjrudin, we are starting to use alerts in MarkLogic server. The queries used in the alert-rules are composed of two parts: one is given by our customers and the other is given by our rights and roles model. From time to time the rights and roles part is updated and thus we need to update the queries in all alert-rules. Here we only want to modify the half of the query that corresponds to the rights and roles, we absolutely do not want to touch the part of the query given by our customers. - Annotations help us to identify the parts correctly.

@rjrudin
Copy link
Contributor

rjrudin commented Mar 29, 2024

Hi @ralfhergert - thanks for the feedback. It's not directly supported today via the Java Client, though you would at least have a workaround of:

  1. Serialize your query to XML.
  2. Manually add the annotation elements (annoying, yes, but I don't know of a better way; I would use JDOM2 for this).
  3. Submit your serialized query.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants