0

I am working on Marklogic Java Optic API and want to execute sql query on result of full-text seach returned by CTS query. My code consists of cts.andQuery() and I want to execute sql query on cts query Result. Something like:

ModifyPlan modifyPlan = planBuilder.fromView(getSchemaName(), getViewName())
.select("col_1","col_2")
.where(planBuilder.cts.andQuery(planBuilder.cts.wordQuery("val1"), planBuilder.cts.wordQuery("val2") ));

Above code works but i want to apply sql query on this result in my java class.

1 Answer 1

1

Can you expand on what you're trying to do and the obstacle you're running into?

The query above is a relational query -- it retrieves rows but only those populated from the documents matched by the cts.query

If you put the where() operation before the select() operation, that sequence of operations is equivalent conceptually to how the engine executes the operations.

The Optic builder provides operations equivalent to the SQL clauses including

  • select() for projection
  • where() on a column boolean expression for filtering
  • groupBy() for aggregation
  • joinInner() or joinLeftOuter() for joins between views

and so on. You can have any number of such operations in any order. For instance, the same query can have a where() operation that filters based on a cts.query followed by a where() operation that filters based on a boolean expression for the columns.

To put it another way, the Optic builder does not have the artificial constraints of the SQL grammar but instead exposes the relational operations directly.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.