ML Friends,

I'm performing a search:search query, and I get a different @total
number of results depending on the paging options for this query:

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

let $wildcarded-phrase := "*a*"
let $terms := ("a")
let $lang := "spa"
let $current-collection-uri := "mexico-web-draft"
let $start := 1
let $page-length := 10
let $wildcard-terms :=
       for $t in $terms
       return fn:concat("*", $t, "*")
let $options :=
       <options xmlns="http://marklogic.com/appservices/search";>

               
<additional-query>{cts:collection-query($current-collection-uri)}</additional-query>
               <additional-query>{cts:field-word-query("articleSearch",
$wildcard-terms, ("wildcarded", fn:concat("lang=",
$lang)))}</additional-query>

               <searchable-expression>/article</searchable-expression>

               <term>
                       <term-option>wildcarded</term-option>
                       <term-option>diacritic-insensitive</term-option>
                       <term-option>case-insensitive</term-option>
                       <term-option>lang={$lang}</term-option>
               </term>

       </options>
return search:search($wildcarded-phrase, $options, $start, $page-length)

For instance, on page 1 and 2 (each 10 items in length), the total is
consistent at 80.  But on page 3, it dips to 76; on page 4, 66; page
5, 53; and on page 6, it falls to 0 results total.

I've seen another thread w/ this symptom where the non-default sort
order might be the culprit:

http://markmail.org/search/?q=search%3Asearch+total+changes#query:search%3Asearch%20total%20changes+page:1+mid:sbe7oe4kfdoph55p+state:results

But I'm not giving non-default sort opts.

I've found if I remove the 2nd additional query:

<additional-query>{cts:field-word-query("articleSearch",
$wildcard-terms, ("wildcarded", fn:concat("lang=",
$lang)))}</additional-query>

The total results is consistent on all pages at 80 items, so that
could very well be my culprit, but I'm not sure why.

The articleSearch database field contains 5 nodes that may or may not
exist inside my article documents (searchable-expression).  The field
is in the default collation with all the default opts.

Thanks for your insight,
Jake
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to