Marklogic 返回不同结果的cts:uri和cts:search
我有一个奇怪的问题,我正在做cts:uri和cts:search。。我的cts:uris给了我7个结果,而作为cts:search只给了3个结果 不确定我做错了什么,希望有人能指出我做错了什么。我尝试了我所知道的所有可能性:)。。遵循我正在运行的代码Marklogic 返回不同结果的cts:uri和cts:search,marklogic,marklogic-8,Marklogic,Marklogic 8,我有一个奇怪的问题,我正在做cts:uri和cts:search。。我的cts:uris给了我7个结果,而作为cts:search只给了3个结果 不确定我做错了什么,希望有人能指出我做错了什么。我尝试了我所知道的所有可能性:)。。遵循我正在运行的代码 xquery version "1.0-ml"; declare namespace html = "http://www.w3.org/1999/xhtml"; import module namespace search = "http://m
xquery version "1.0-ml";
declare namespace html = "http://www.w3.org/1999/xhtml";
import module namespace search = "http://marklogic.com/appservices/search" at "/MarkLogic/appservices/search/search.xqy";
let $q := '(Dermatolog*) AND ((context:KN)) AND ((gene:"STAT3") AND (indication:"Carcinoma")) AND ((uploadDate:"today")) AND (sort:date_desc)'
let $options :=
<options xmlns="http://marklogic.com/appservices/search">
<additional-query>
<cts:collection-query xmlns:cts="http://marklogic.com/cts">
<cts:uri>http://abc/xyz/type/envelope</cts:uri>
</cts:collection-query>
</additional-query>
<operator name="sort">
<state name="date_desc">
<sort-order type="xs:dateTime" direction="descending">
<field name="upload_date"/>
</sort-order>
</state>
<state name="date_asc">
<sort-order type="xs:dateTime" direction="ascending">
<field name="upload_date"/>
</sort-order>
</state>
</operator>
<constraint name="context">
<range type="xs:string" facet="true">
<element name="context" ns="http://abc/xyz/metadata"/>
<facet-option>frequency-order</facet-option>
<facet-option>descending</facet-option>
</range>
</constraint>
<constraint name="type">
<range type="xs:string" facet="true">
<element name="type" ns="http://abc/xyz/metadata"/>
<facet-option>frequency-order</facet-option>
<facet-option>descending</facet-option>
</range>
</constraint>
<constraint name="file-type">
<range type="xs:string" facet="true">
<element name="file-type" ns="http://abc/xyz/metadata"/>
<facet-option>frequency-order</facet-option>
<facet-option>descending</facet-option>
</range>
</constraint>
<constraint name="drug">
<range type="xs:string" facet="true">
<path-index>//Hit[@type='DRUG']/Name</path-index>
<facet-option>frequency-order</facet-option>
<facet-option>descending</facet-option>
<facet-option>limit=10</facet-option>
</range>
</constraint>
<constraint name="compound">
<range type="xs:string" facet="true">
<path-index>//Hit[@type='COMPOUNDS']/Name</path-index>
<facet-option>frequency-order</facet-option>
<facet-option>descending</facet-option>
<facet-option>limit=10</facet-option>
</range>
</constraint>
<constraint name="species">
<range type="xs:string" facet="true">
<path-index>//Hit[@type='SPECIES']/Name</path-index>
<facet-option>frequency-order</facet-option>
<facet-option>descending</facet-option>
<facet-option>limit=10</facet-option>
</range>
</constraint>
<constraint name="company">
<range type="xs:string" facet="true">
<path-index>//Hit[@type='COMPANY']/Name</path-index>
<facet-option>frequency-order</facet-option>
<facet-option>descending</facet-option>
<facet-option>limit=10</facet-option>
</range>
</constraint>
<constraint name="indication">
<range type="xs:string" facet="true">
<path-index>//Hit[@type='INDICATION']/Name</path-index>
<facet-option>frequency-order</facet-option>
<facet-option>descending</facet-option>
<facet-option>limit=10</facet-option>
</range>
</constraint>
<constraint name="gene">
<range type="xs:string" facet="true">
<path-index>//Hit[@type='GENE']/@id</path-index>
<facet-option>frequency-order</facet-option>
<facet-option>descending</facet-option>
<facet-option>limit=10</facet-option>
</range>
</constraint>
<constraint name="uploadDate">
<range type="xs:dateTime" facet="true">
<computed-bucket lt="P1D" ge="P0D" anchor="start-of-day" name="today">Today</computed-bucket>
<computed-bucket lt="P0D" ge="-P1D" anchor="start-of-day" name="yesterday">Yesterday</computed-bucket>
<computed-bucket lt="-P1D" ge="-P15D" anchor="start-of-day" name="2-weeks">Last 2 Weeks</computed-bucket>
<computed-bucket lt="-P15D" ge="-P30D" anchor="start-of-day" name="month">A Month ago</computed-bucket>
<computed-bucket lt="-P30D" ge="-P365D" anchor="start-of-day" name="year">A Year ago</computed-bucket>
<computed-bucket name="older" lt="-P365D" anchor="start-of-day">Older</computed-bucket>
<facet-option>descending</facet-option>
<field name="upload_date"/>
</range>
</constraint>
<constraint name="author">
<range type="xs:string" facet="true">
<facet-option>frequency-order</facet-option>
<facet-option>descending</facet-option>
<facet-option>limit=10</facet-option>
<field name="author"/>
</range>
</constraint>
<term>
<term-option>case-insensitive</term-option>
<term-option>punctuation-insensitive</term-option>
<term-option>whitespace-insensitive</term-option>
<term-option>wildcarded</term-option>
</term>
<return-facets>true</return-facets>
<return-results>true</return-results>
<transform-results apply="empty-snippet"/>
</options>
return
(
cts:uris("", ('document'), cts:query(search:parse($q, $options))),
cts:search(fn:doc(), cts:query(search:parse($q, $options)))
)
xquery版本“1.0-ml”;
声明命名空间html=”http://www.w3.org/1999/xhtml";
导入模块命名空间搜索=”http://marklogic.com/appservices/search“在“/MarkLogic/appservices/search/search.xqy”;
让$q:='(Detrolog*)和((上下文:KN))和((基因:“STAT3”)和(适应症:“癌”))和((上传日期:“今天”)和(排序:日期描述)'
let$options:=
http://abc/xyz/type/envelope
频率顺序
下降的
频率顺序
下降的
频率顺序
下降的
//点击[@type='drugh']/Name
频率顺序
下降的
限值=10
//点击[@type='components']/Name
频率顺序
下降的
限值=10
//点击[@type='SPECIES']/Name
频率顺序
下降的
限值=10
//点击[@type='COMPANY']/Name
频率顺序
下降的
限值=10
//点击[@type='INDICATION']/Name
频率顺序
下降的
限值=10
//点击[@type='GENE']/@id
频率顺序
下降的
限值=10
今天
昨天
最后两周
一个月前
一年前
更老的
下降的
频率顺序
下降的
限值=10
不区分大小写
标点不敏感
不区分空格
通配符
真的
真的
返回
(
cts:uri(“,('document'),cts:query(搜索:解析($q$options)),
cts:search(fn:doc(),cts:query(search:parse($q$options)))
)
这是过滤与未过滤查询的效果cts:uri
只能在未经筛选的情况下运行,这意味着它只使用索引,并且可能返回误报,具体取决于您的索引设置<代码>cts:search默认情况下过滤查询,您必须在options参数中指定unfiltered
还要注意的是,当您使用
cts:search
而不是search:resolve
时,在
元素中指定的大多数选项不会自动应用,包括对于镶嵌面也是这样吗?是的,这是正确的。所有基于词典的函数只能在未经筛选的情况下运行。感谢您的澄清。。过滤与未过滤总是让我着迷