简体   繁体   English

MarkLogic 光学 API - 分组

[英]MarkLogic Optic API - Group By

Can we use "case-sensitive" or "case-insensitive" in op:group-by in XQuery?我们可以在 XQuery 的 op:group-by 中使用“区分大小写”或“不区分大小写”吗?

I want to group the values irrespective of case.我想对值进行分组,而不考虑大小写。 If there is any solution, please give an example.如果有解决办法,请举个例子。

Thanks in advance!提前致谢!

One way to solve the problem is to make the string values of the grouping key all upper or lower case before grouping.解决该问题的一种方法是在分组之前使分组键的字符串值全部大写或小写。

For a small data set, an op:select() statement could list the indexed columns needed for the output and also construct a dynamic grouping key column with:对于小型数据集,op:select() 语句可以列出 output 所需的索引列,并构造一个动态分组键列:

op:as("upperCaseGroupingKey", ofn:upper-case(op:col("variableCaseGroupingKey")))

For larger data sets, however, it will perform better to construct the grouping key using the fn:upper-case() function in the TDE that projects the rows out of the document into the index.但是,对于较大的数据集,在将文档中的行投影到索引中的 TDE 中,使用 fn:upper-case() function 构造分组键会更好。

Hoping that helps,希望有帮助,

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

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