2016-08-25 6 views
3

私は奇妙な問題があります。私はcts:uriとcts:searchをやっています。そして、私のcts:urisは私に7つの結果を与えます。cts:urisとcts:異なる結果を返す検索

私が間違ってやっていることがわからない、誰かが私が間違っていることを指摘できると願っています。私は私の知っているすべての可能性を試してみました:) ..私は

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))) 
    ) 

答えて

8

これは、フィルタリングされていないクエリ対フィルタの効果であるが実行しているコードは次のよう。 cts:urisは、フィルタリングされていない状態でのみ実行できます。つまり、インデックスのみを使用し、インデックスの設定に応じて誤検出を返す可能性があります。 cts:searchはデフォルトでクエリをフィルタリングし、オプションパラメータにunfilteredを指定する必要があります。

はまた、あなたの<search:options>要素で指定されたほとんどのオプションは、あなたが<additional-query>含むcts:searchの代わりsearch:resolveを使用する場合が自動的に適用されていないであることに注意してください。

+0

これはファセット面でも同じですか? – Ravi

+0

はい、そうです。すべての辞書ベースの関数は、フィルタリングなしでのみ実行されます。 – wst

+0

清算していただきありがとうございます。 – Ravi

関連する問題