简体   繁体   English

Marklogic在光纤Java API中执行SQL查询

[英]Marklogic execute sql query in optic Java API

I am working on Marklogic Java Optic API and want to execute sql query on result of full-text seach returned by CTS query. 我正在使用Marklogic Java Optic API,并且想对CTS查询返回的全文搜索结果执行sql查询。 My code consists of cts.andQuery() and I want to execute sql query on cts query Result. 我的代码由cts.andQuery()组成,我想对cts查询结果执行sql查询。 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. 上面的代码有效,但是我想在我的java类中对此结果应用sql查询。

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 上面的查询是一个关系查询-它检索行,但仅检索与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. 如果将where()操作放在select()操作之前,则该操作序列在概念上等效于引擎如何执行这些操作。

The Optic builder provides operations equivalent to the SQL clauses including “光学”构建器提供与SQL子句等效的操作,包括

  • select() for projection select()进行投影
  • where() on a column boolean expression for filtering 列布尔表达式上的where()用于过滤
  • groupBy() for aggregation groupBy()进行聚合
  • joinInner() or joinLeftOuter() for joins between views joinInner()或joinLeftOuter()用于视图之间的联接

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. 例如,同一个查询可以具有基于cts.query进行过滤的where()操作,然后具有基于列的布尔表达式进行过滤的where()操作。

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. 换句话说,Optic生成器没有人为限制SQL语法,而是直接公开关系操作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM