The problem is almost certainly caused by the use of wildcards in the Title search term.
Our approach has usually been to provide only approximate counts when the user's term includes a wildcard. Of course this has complicating implications for the pagination system, which has to deal with the possibility that its projections are incorrect... -Mike On 05/09/2012 09:45 PM, Sunny Wang01 wrote: > Hi Geert, > The value of parameter is like: > $search-condition :"Title":"*hits*" AND > sort:ModifiedDate AND modified-date:span > $show-me :"Course" > $start-date: "0001-01-01T00:00:00" > $end-date :" 2012-04-05T00:00:00" > $uris :"" > $page-size :10 > $page :1 > > > Thanks, > Sunny Wang01 > > > > > -----Original Message----- > From: [email protected] > [mailto:[email protected]] On Behalf Of Geert Josten > Sent: 2012年5月9日 22:22 > To: MarkLogic Developer Discussion > Subject: Re: [MarkLogic Dev General] The value of @total is not right > > Hi Sunny, > > And an example of the search-condition perhaps? > > On a side track: where do start and end date come from? > > Kind regards, > Geert > > >> -----Oorspronkelijk bericht----- >> Van: [email protected] [mailto:general- >> [email protected]] Namens Sunny Wang01 >> Verzonden: woensdag 9 mei 2012 11:35 >> Aan: MarkLogic Developer Discussion >> Onderwerp: Re: [MarkLogic Dev General] The value of @total is not >> right >> >> Hi, >> The below is my one method, the index for search I have added. >> >> declare function local:get-search-result($search-condition as >> > xs:string*, > >> $show-me as xs:string* , >> $start-date as xs:string* , >> $end-date as xs:string*, >> $uris as xs:string*, >> $page-size as xs:int , >> $page as xs:int) as item()* >> { >> >> (:--------------------------------construct the search condition >> > -------------------------- > >> -----------:) >> >> let $collection:= >> if($show-me eq ("Everything" , "All", "") or >> > fn:empty($show-me)) > >> then >> cts:collection- >> query(("ResourceCollection","FileCollection","CourseCollection")) >> else cts:collection-query("CourseCollection") >> >> let $options:=<search:options> >> <search:constraint name="modified-date"> >> <search:range type="xs:dateTime"> >> <search:element >> ns="http://www.careered.com/Version" name="ModifiedDate"/> >> <search:bucket ge={$start- >> date} lt={$end-date} name="span"/> >> </search:range> >> </search:constraint> >> <search:constraint name="created-date"> >> <search:range type="xs:dateTime"> >> <search:element >> ns="http://www.careered.com/Metadata" name="CreateDate"/> >> <search:bucket ge={$start- >> date} lt={$end-date} name="span"/> >> </search:range> >> </search:constraint> >> <search:operator name="sort"> >> <search:state name="Title"> >> <search:sort-order >> direction="ascending" type="xs:string"> >> <search:element >> ns="http://www.careered.com/Metadata" name="Title" /> >> </search:sort-order> >> </search:state> >> <search:state name="ModifiedDate"> >> <search:sort-order >> direction="descending" type="xs:dateTime"> >> <search:element >> ns="http://www.careered.com/Version" name="ModifiedDate" /> >> </search:sort-order> >> </search:state> >> <search:state name="CreateDate"> >> <search:sort-order >> direction="descending" type="xs:dateTime"> >> <search:element >> ns="http://www.careered.com/Metadata" name="CreateDate" /> >> </search:sort-order> >> </search:state> >> <search:state name="Institution"> >> <search:sort-order >> direction="ascending" type="xs:string"> >> <search:element >> ns="http://www.careered.com/CourseElement" name="Institution" /> >> </search:sort-order> >> </search:state> >> </search:operator> >> <search:constraint name="Description"> >> <search:word> >> <search:element >> ns="http://www.careered.com/Metadata" name="Description"/> >> </search:word> >> </search:constraint> >> <search:constraint name="Category"> >> <search:word> >> <search:element >> ns="http://www.careered.com/CourseElement" name="Category"/> >> </search:word> >> </search:constraint> >> <search:constraint name="Title"> >> <search:word> >> <search:element >> ns="http://www.careered.com/Metadata" name="Title"/> >> </search:word> >> </search:constraint> >> <search:constraint name="CourseCode"> >> <search:value> >> <search:element >> ns="http://www.careered.com/CourseElement" name="CourseCode"/> >> </search:value> >> </search:constraint> >> <search:constraint name="ID"> >> <search:value> >> <search:element >> ns="http://www.careered.com/Metadata" name="ID"/> >> </search:value> >> </search:constraint> >> <search:constraint name="Keywords"> >> <search:word> >> <search:element >> ns="http://www.careered.com/Metadata" name="Keywords"/> >> </search:word> >> </search:constraint> >> <search:constraint name="Author"> >> <search:value> >> <search:element >> ns="http://www.careered.com/Metadata" name="Author"/> >> </search:value> >> </search:constraint> >> <search:constraint name="Note"> >> <search:word> >> <search:element >> ns="http://www.careered.com/Version" name="Note"/> >> </search:word> >> </search:constraint> >> <search:constraint name="ModifiedBy"> >> <search:value> >> <search:element >> ns="http://www.careered.com/Version" name="ModifiedBy"/> >> </search:value> >> </search:constraint> >> <search:constraint name="Language"> >> <search:value> >> <search:element >> ns="http://www.careered.com/Metadata" name="Language"/> >> </search:value> >> </search:constraint> >> <search:constraint name="FileType"> >> <search:value> >> <search:element >> ns="http://www.careered.com/CourseElement" name="FileType"/> >> </search:value> >> </search:constraint> >> <search:constraint name="Identifier"> >> <search:value> >> <search:element >> ns="http://www.careered.com/CourseElement" name="Identifier"/> >> </search:value> >> </search:constraint> >> <search:constraint name="IsActive"> >> <search:value> >> <search:element >> ns="http://www.careered.com/Metadata" name="IsActive"/> >> </search:value> >> </search:constraint> >> <search:constraint >> > name="Is3rdPartyContent"> > >> <search:value> >> <search:element >> ns="http://www.careered.com/CourseElement" name="Is3rdPartyContent"/> >> </search:value> >> </search:constraint> >> <search:constraint name="ResourceType"> >> <search:value> >> <search:element >> ns="http://www.careered.com/CourseElement" name="ResourceType"/> >> </search:value> >> </search:constraint> >> <search:additional-query> >> { >> if(fn:empty($uris) or >> > $uris eq "") > >> then () >> else >> cts:document- >> query(($uris)) >> } >> </search:additional-query> >> <search:additional- >> query>{$collection}</search:additional-query> >> <search:additional-query>{dls:documents- >> query()}</search:additional-query> >> <search:term-option>case- >> insensitive</search:term-option> >> <search:term- >> option>wildcarded</search:term-option> >> <search:term-option>diacritic- >> insensitive</search:term-option> >> </search:options> >> >> (:----------------------------------------get search result >> > ----------------------------------- > >> --------:) >> >> return search:search($search-condition,$options,$page-size * >> > ($page - > >> 1)+1,$page-size) >> >> }; >> >> >> Thanks, >> Sunny Wang01 >> >> >> -----Original Message----- >> From: [email protected] [mailto:general- >> [email protected]] On Behalf Of Geert Josten >> Sent: 2012年5月9日 16:30 >> To: MarkLogic Developer Discussion >> Subject: Re: [MarkLogic Dev General] The value of @total is not right >> >> Hi Sunny, >> >> That is a known 'issue'. It is because search results are counted in >> > so-called > >> 'unfiltered' mode for performance reasons. It uses xdmp:estimate under >> > the > >> hood. Apparently you are doing a search that requires filtering of >> > search results. > >> Can you give some more details about your search query? >> >> Kind regards, >> Geert >> >> >>> -----Oorspronkelijk bericht----- >>> Van: [email protected] [mailto:general- >>> [email protected]] Namens Sunny Wang01 >>> Verzonden: woensdag 9 mei 2012 9:40 >>> Aan: MarkLogic Developer Discussion >>> Onderwerp: [MarkLogic Dev General] The value of @total is not right >>> >>> Hi, >>> >>> Could you help to resolve the below issue? >>> >>> Using search:search in the Marklogic retrieve the search result, but >>> the >>> >> returned >> >>> value @total is sometimes bigger than the real count of search >>> result, >>> >> it makes >> >>> the pagination doesn't work correctly. >>> >>> Thanks, >>> Sunny Wang01 >>> >>> **************** CAUTION - Disclaimer ***************** This e-mail >>> contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely for >>> the use of the addressee(s). If you are not the intended recipient, >>> >> please >> >>> notify the sender by e-mail and delete the original message. >>> Further, >>> >> you are not >> >>> to copy, disclose, or distribute this e-mail or its contents to any >>> >> other person and >> >>> any such actions are unlawful. This e-mail may contain viruses. >>> Infosys >>> >> has taken >> >>> every reasonable precaution to minimize this risk, but is not liable >>> for >>> >> any >> >>> damage >>> you may sustain as a result of any virus in this e-mail. You should >>> >> carry out your >> >>> own virus checks before opening the e-mail or attachment. Infosys >>> >> reserves the >> >>> right to monitor and review the content of all messages sent to or >>> from >>> >> this e- >> >>> mail >>> address. Messages sent to or from this e-mail address may be stored >>> on >>> >> the >> >>> Infosys e-mail system. >>> ***INFOSYS******** End of Disclaimer ********INFOSYS*** >>> _______________________________________________ >>> General mailing list >>> [email protected] >>> http://developer.marklogic.com/mailman/listinfo/general >>> >> _______________________________________________ >> General mailing list >> [email protected] >> http://developer.marklogic.com/mailman/listinfo/general >> _______________________________________________ >> General mailing list >> [email protected] >> http://developer.marklogic.com/mailman/listinfo/general >> > _______________________________________________ > General mailing list > [email protected] > http://developer.marklogic.com/mailman/listinfo/general > _______________________________________________ > General mailing list > [email protected] > http://developer.marklogic.com/mailman/listinfo/general > _______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general
