Created
July 20, 2011 21:45
-
-
Save evanlenz/1095997 to your computer and use it in GitHub Desktop.
Code examples for article http://developer.marklogic.com/blog/learning-with-query-trace
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//group[@type eq 'widget'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for $n in (1 to 300) return | |
xdmp:document-insert(concat("/group",$n,".xml"), | |
document { | |
let $pos := ($n mod 3) + 1 | |
let $type := ("widget","person","place")[$pos] return | |
<group type="{$type}">stuff</group> | |
} | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xdmp:query-trace(true()), | |
//group[@type eq 'widget'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Analyzing path: fn:collection()/descendant::group[@type eq "widget"] | |
Step 1 is searchable: fn:collection() | |
Step 2 is searchable: descendant::group[@type eq "widget"] | |
Path is fully searchable. | |
Gathering constraints. | |
Comparison contributed hash value constraint: group/@type = "widget" | |
Step 2 predicate 1 contributed 1 constraint: @type eq "widget" | |
Comparison contributed hash value constraint: group/@type = "widget" | |
Step 2 predicate 1 contributed 1 constraint: @type eq "widget" | |
Step 2 contributed 2 constraints: descendant::group[@type eq "widget"] | |
Executing search. | |
Selected 100 fragments to filter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for $n in (1 to 300) return | |
xdmp:document-insert(concat("/logfile",$n,".xml"), | |
document { | |
let $pos := ($n mod 3) + 1 | |
let $host := concat("host",$pos) return | |
<logfile host="{$host}"/> | |
} | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xdmp:query-trace(true()), | |
//logfile[@host eq 'host1'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Selected 100 fragments to filter |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment