Changeset 833 for MDRepository
- Timestamp:
- 11/02/10 22:25:15 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
MDRepository/trunk/xquery/cmd-model.xqm
r831 r833 80 80 util:eval(fn:concat("$collection", $sanitized-query, "/ancestor-or-self::CMD")) 81 81 else 82 for $coll in $collections return util:eval(fn:concat("$collection ", $sanitized-query, "/ancestor-or-self::CMD[descendant::IsPartOf = '", xdb:decode($coll) ,"']"))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, "]")) 83 83 84 84 let $result-count := fn:count($results), … … 89 89 <searchRetrieveResponse> 90 90 <numberOfRecords>{$result-count}</numberOfRecords> 91 <echoedSearchRetrieveRequest>{if ($decoded-query ne $sanitized-query) then "Rewritten to descendant-or-self::CMD"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> 92 92 <extraResponseData> 93 94 93 <returnedRecords>{$seq-count}</returnedRecords> 94 <duration>{$end-time - $start-time}</duration> 95 95 </extraResponseData> 96 96 <records> … … 110 110 111 111 declare function cmd-model:sanitize-query($query as xs:string) as xs:string { 112 if ($query = ("//*", "descendant::element()")) then "/descendant-or-self::CMD" else $query 112 let $last-segment := text:groups($query, "/([^/]+)$")[last()] 113 return 114 if ($query = ("//*", "descendant::element()")) then 115 "/descendant-or-self::CMD" 116 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>)") :) 118 else $query 113 119 }; 114 120
Note: See TracChangeset
for help on using the changeset viewer.