将 cts:search 的逻辑转换为 search:search

Converting the logic for cts:search to search:search

我一直在我的项目中使用 cts:search,但不知何故感觉结果时间比预期的要长一些。 search:search 有帮助吗?如果是,怎么做?

例如我的查询为

let $query := cts:and-query((cts:element-value-query(xs:QName("Applicability"),"Yes"))) 

我想获取文档 URI。我正在使用:

cts:search(collection("abc"), $query) 

它返回了 URI,但是如何使用 search:search 提取它? 或者是否有搜索以外的其他方法可以帮助缩短执行时间?

您有兴趣检索文档,还是只检索 URI?

如果您只想检索包含具有该值的元素的文档的 URI,请使用 cts:uris() 而不是 cts:search()cts:uris() 函数运行时未过滤,只会从词典中获取 return 个 URI,而不是检索所有文档,如果您不需要内容。

cts:uris("", (), cts:and-query(( collection("abc"), $query)) ) 

当使用 cts:search 时,我首先要尝试的是将 unfiltered 选项添加到您的搜索中,看看是否有帮助。

默认情况下 cts:search 执行过滤:

A filtered search (the default). Filtered searches eliminate any false-positive matches and properly resolve cases where there are multiple candidate matches within the same fragment. Filtered search results fully satisfy the specified cts:query.

因此,尝试使用“未过滤”选项执行相同的查询:

cts:search(collection("abc"), $query, "unfiltered") 

您还可以在该 Applicability 元素上创建 an index,使用元素范围索引或字段范围索引,然后使用适当的范围查询而不是值-查询。