我使用这个表达式来搜索文档
search:search(
'(content:"value of imports")',
<options xmlns="http://marklogic.com/appservices/search">
<constraint name="content">
<element-query ns="" name="content" />
</constraint>
<additional-query>{cts:collection-query("document-binary")}</additional-query>
</options>
)并在结果
<search:response snippet-format="snippet" total="16" start="1" page-length="10" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="" xmlns:search="http://marklogic.com/appservices/search">
<search:qtext>(content:"value of imports")</search:qtext>
<search:metrics>
<search:query-resolution-time>PT0.319222S</search:query-resolution-time>
<search:facet-resolution-time>PT0.000124S</search:facet-resolution-time>
<search:snippet-resolution-time>PT0S</search:snippet-resolution-time>
<search:total-time>PT0.319721S</search:total-time>
</search:metrics>
</search:response>如果我在搜索表达式中只留下一个单词,则搜索将正常工作
content:"value"发布于 2014-09-08 23:33:41
total是对结果数量的未经过滤的估计。但是,默认情况下会过滤结果。当结果与计数不匹配时,您可以尝试使用unfiltered选项来查看这是否是原因。您还可以尝试使用xdmp:query-trace或search:search的return-plan选项来查看发生了什么。您还可以使用cts:uris查看未过滤搜索返回的文档URI。
有关过滤搜索与未过滤搜索的更多信息,请参阅https://docs.marklogic.com/guide/search-dev/search-api、https://docs.marklogic.com/guide/search-dev/count_estimate和https://docs.marklogic.com/guide/performance/unfiltered上的文档
在这种特殊情况下,过滤和未过滤结果之间的差异可能是由于快速短语索引的工作方式造成的。您的短语value of imports将变成一个两个单词的术语value of和一个两个单词的术语of imports。可能有16个文档同时包含这两个术语。但这并不意味着它们中的任何一个都与完整的三个单词短语匹配。如果是这样的话,索引查找仍然匹配16,但是过滤没有找到匹配。
发布于 2014-09-08 21:58:37
元素查询约束匹配其他元素的容器:
如果要匹配元素的文本内容,请尝试值查询或单词查询:
如下所示:
search:search(
'(content:"value of imports")',
<options xmlns="http://marklogic.com/appservices/search">
<constraint name="content">
<value>
<element ns="" name="content" />
</value>
</constraint>
<additional-query>{cts:collection-query("document-binary")}</additional-query>
</options>)如果document-binary集合标记二进制文档,我希望得到一个空的结果集,因为额外的查询与其他查询是与相关的。
希望这能有所帮助,
埃里克·亨纳姆
https://stackoverflow.com/questions/25722456
复制相似问题