Hi, Danny:

Thanks for the additional information.  The total is set to the estimate based 
on the indexes.

That's pragmatic for pages other than the last page. In that case, we can 
calculate an accurate total based on the start page, page length, and result 
count.

I'll file a bug.


Erik Hennum

________________________________
From: general-boun...@developer.marklogic.com 
[general-boun...@developer.marklogic.com] on behalf of Danny Sinang 
[d.sin...@gmail.com]
Sent: Tuesday, January 06, 2015 6:24 AM
To: MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] Search API total not equal to number of 
search results

One thing I discovered is that if I change "search-option" to "unfiltered", 
@total and the number of search results are both 88.

Regards,
Danny

On Tue, Jan 6, 2015 at 9:14 AM, Danny Sinang 
<d.sin...@gmail.com<mailto:d.sin...@gmail.com>> wrote:
Hi Erik,

Here's the query and the options :

xquery version "1.0-ml";


import module namespace search = "http://marklogic.com/appservices/search";
    at "/MarkLogic/appservices/search/search.xqy";

declare option xdmp:mapping "false";

declare variable $options :=
<options xmlns="http://marklogic.com/appservices/search";>
   <search-option>filtered</search-option>
   <debug>false</debug>
   <term>
     <empty apply="all-results"/>
     <term-option>wildcarded</term-option>
     <term-option>case-insensitive</term-option>
     <term-option>punctuation-sensitive</term-option>
     <term-option>diacritic-sensitive</term-option>
   </term>
   <grammar>
     <starter strength="30" apply="grouping" delimiter=")">(</starter>
     <starter strength="40" apply="prefix" element="cts:not-query">-</starter>
     <joiner strength="10" apply="infix" element="cts:or-query" 
tokenize="word">OR</joiner>
     <joiner strength="20" apply="infix" element="cts:and-query" 
tokenize="word">AND</joiner>
     <joiner strength="20" apply="element-joiner" 
ns="http://www.nejm.org/custom-field-query"; at="/lib/custom-fields.xqy" 
element="cts:element-query" tokenize="word">CHILD</joiner>
     <joiner strength="50" apply="constraint" compare="LT" 
tokenize="word">LT</joiner>
     <joiner strength="50" apply="constraint" compare="LE" 
tokenize="word">LE</joiner>
     <joiner strength="50" apply="constraint" compare="GT" 
tokenize="word">GT</joiner>
     <joiner strength="50" apply="constraint" compare="GE" 
tokenize="word">GE</joiner>
     <joiner strength="50" apply="constraint" compare="NE" 
tokenize="word">NE</joiner>
     <quotation>"</quotation>
     <joiner strength="50" apply="constraint">:</joiner>
   </grammar>
   <!--
   <searchable-expression>/questionAsset</searchable-expression>
   -->
   <constraint name="qbankId">
     <value>
       <element ns="" name="qBankId"/>
     </value>
   </constraint>
   <constraint name="key">
     <value>
       <element ns="" name="key"/>
     </value>
   </constraint>
   <constraint name="qId">
     <value>
       <element ns="" name="qId"/>
     </value>
   </constraint>
   <constraint name="productId">
     <value>
       <element ns="" name="productId"/>
     </value>
   </constraint>
   <constraint name="qAuthoringState">
     <value>
       <element ns="" name="qAuthoringState"/>
     </value>
   </constraint>
   <constraint name="qBankMembershipState">
     <value>
       <element ns="" name="qBankMembershipState"/>
     </value>
   </constraint>
   <constraint name="qApName">
     <value>
       <element ns="" name="qApName"/>
     </value>
   </constraint>
   <constraint name="accreditationTypeState">
     <value>
       <element ns="" name="accreditationTypeState"/>
     </value>
   </constraint>
   <constraint name="questionSetName">
     <value>
       <element ns="" name="questionSetName"/>
     </value>
   </constraint>
   <constraint name="qComments">
     <custom facet="false">
       <parse apply="qComments" ns="http://www.nejm.org/custom-field-query"; 
at="/lib/custom-fields.xqy"/>
     </custom>
   </constraint>
   <constraint name="qSupplementGroup">
     <custom facet="false">
       <parse apply="qSupplementGroup" 
ns="http://www.nejm.org/custom-field-query"; at="/lib/custom-fields.xqy"/>
     </custom>
   </constraint>
   <constraint name="qQuestionOfTheWeek">
     <custom facet="false">
       <parse apply="qQuestionOfTheWeek" 
ns="http://www.nejm.org/custom-field-query"; at="/lib/custom-fields.xqy"/>
     </custom>
   </constraint>
   <constraint name="qFITB">
     <custom facet="false">
       <parse apply="qFITB" ns="http://www.nejm.org/custom-field-query"; 
at="/lib/custom-fields.xqy"/>
     </custom>
   </constraint>
   <constraint name="qApDifferentiation">
     <range type="xs:double">
       <element ns="" name="qApDifferentiation"/>
     </range>
   </constraint>
   <constraint name="qApDiscrimination">
     <range type="xs:double">
       <element ns="" name="qApDiscrimination"/>
     </range>
   </constraint>
   <constraint name="qApRelevance">
     <range type="xs:double">
       <element ns="" name="qApRelevance"/>
     </range>
   </constraint>
   <constraint name="qCreatedDate">
     <range type="xs:dateTime">
       <element ns="" name="qCreatedDate"/>
     </range>
   </constraint>
   <constraint name="qLastModifiedDate">
     <range type="xs:dateTime">
       <element ns="" name="qLastModifiedDate"/>
     </range>
   </constraint>
   <constraint name="qAudiencePoolGroup">
     <element-query ns="" name="qAudiencePoolGroup"/>
   </constraint>
   <constraint name="qBankGroup">
     <element-query ns="" name="qBankGroup"/>
   </constraint>
   <constraint name="qBankDimensions">
     <element-query ns="" name="qBankDimensions"/>
   </constraint>
   <constraint name="dimensionFacts">
     <element-query ns="" name="dimensionFacts"/>
   </constraint>
   <constraint name="childDimension">
     <element-query ns="" name="childDimension"/>
   </constraint>
   <constraint name="name">
     <value>
       <element ns="" name="name"/>
     </value>
   </constraint>
   <constraint name="dimension">
     <custom facet="false">
       <parse apply="dimension" ns="http://www.nejm.org/custom-field-query"; 
at="/lib/custom-fields.xqy"/>
     </custom>
   </constraint>
   <constraint name="entry">
     <element-query ns="" name="entry"/>
   </constraint>
   <constraint name="value">
     <element-query ns="" name="value"/>
   </constraint>
   <constraint name="subSpecialty">
     <custom facet="false">
       <parse apply="subSpecialty" ns="http://www.nejm.org/custom-field-query"; 
at="/lib/custom-fields.xqy"/>
     </custom>
   </constraint>
   <return-query>true</return-query>
   <return-facets>false</return-facets>
   <return-metrics>false</return-metrics>
   <additional-query>
     <cts:collection-query xmlns:cts="http://marklogic.com/cts";>
       <cts:uri>question</cts:uri>
     </cts:collection-query>
   </additional-query>
   <operator name="sort">
     <state name="requestparam">
       <sort-order direction="ascending" type="xs:int">
  <element ns="" name="qId"/>
       </sort-order>
       <sort-order>
  <score/>
       </sort-order>
     </state>
   </operator>
 </options>;

let $search := '(qAuthoringState:"Approved" OR qAuthoringState:"Warning") AND 
(qAudiencePoolGroup:(qApName:"Internal Medicine Audience Pool" AND qApRelevance 
GE "1" AND qApRelevance LE "1")) AND (entry:(key:1 AND 
value:(qBankDimensions:(name:"Sub-Specialty" AND 
dimensionFacts:(name:"Cardiology"))))) AND sort:requestparam'
return
    search:search($search, $options, 1, 100)


On Mon, Jan 5, 2015 at 9:45 PM, Erik Hennum 
<erik.hen...@marklogic.com<mailto:erik.hen...@marklogic.com>> wrote:
Hi, Danny:

Can you share your query and options?


Erik Hennum

________________________________
From: 
general-boun...@developer.marklogic.com<mailto:general-boun...@developer.marklogic.com>
 
[general-boun...@developer.marklogic.com<mailto:general-boun...@developer.marklogic.com>]
 on behalf of Danny Sinang [d.sin...@gmail.com<mailto:d.sin...@gmail.com>]
Sent: Monday, January 05, 2015 1:44 PM
To: general
Subject: [MarkLogic Dev General] Search API total not equal to number of search 
results

After running this filtered query :

search:search($search, $options, 1, 100)

I got /search:response/@total = 88 despite there being only 36 search results 
returned by the query.

The content source / database being queried does not have a fragment root or 
parent.

What could I be doing wrong ?

Regards,
Danny




_______________________________________________
General mailing list
General@developer.marklogic.com<mailto:General@developer.marklogic.com>
http://developer.marklogic.com/mailman/listinfo/general



_______________________________________________
General mailing list
General@developer.marklogic.com
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to