Changeset 834 for MDRepository


Ignore:
Timestamp:
11/03/10 09:45:24 (14 years ago)
Author:
ljo
Message:

cmd-model.xqm - no need to rewrite to predicate for * etc.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • MDRepository/trunk/xquery/cmd-model.xqm

    r833 r834  
    8080      util:eval(fn:concat("$collection", $sanitized-query, "/ancestor-or-self::CMD"))
    8181    else
    82       for $coll in $collections return util:eval(fn:concat("$collection/ft:query(descendant::IsPartOf, <term>", xdb:decode($coll) ,"</term>)/ancestor-or-self::CMD[", $sanitized-query, "]"))
     82      for $coll in $collections return util:eval(fn:concat("$collection/ft:query(descendant::IsPartOf, <term>", xdb:decode($coll) ,"</term>)/ancestor-or-self::CMD", $sanitized-query))
    8383
    8484    let $result-count := fn:count($results),
     
    8989    <searchRetrieveResponse>
    9090      <numberOfRecords>{$result-count}</numberOfRecords>
    91       <echoedSearchRetrieveRequest>{if ($decoded-query ne $sanitized-query) then concat("Rewritten to ", $sanitized-query) else $xpath-query, $collections, $start-item, $end-item}</echoedSearchRetrieveRequest>
     91      <echoedSearchRetrieveRequest>{if ($decoded-query ne $sanitized-query) then concat("Rewritten to '", $sanitized-query, "'") else $xpath-query, $collections, $start-item, $end-item}</echoedSearchRetrieveRequest>
    9292      <extraResponseData>
    9393        <returnedRecords>{$seq-count}</returnedRecords>
     
    113113return
    114114  if ($query = ("//*", "descendant::element()")) then
    115     "/descendant-or-self::CMD"
     115    ""
    116116  else if ($last-segment = ("Title", "Name", "Role", "Genre", "Country", "Continent", "MdSelfLink", "IsPartOf")) then
    117     (: concat("ft:query(",:) if ($query eq concat("//", $last-segment)) then concat("descendant::", $last-segment) else $query (:, ", <regex>.*</regex>)") :)
     117    (: concat("ft:query(",:) if ($query eq concat("//", $last-segment)) then concat("[descendant::", $last-segment, "]") else concat("[", $query, "]") (:, ", <regex>.*</regex>)") :)
    118118  else $query
    119119};
Note: See TracChangeset for help on using the changeset viewer.