Hi all,
Apologies in advance for the length of this email . . .
I'm trying to generate a list unique authors with their associated titles
from a taxonomy element that's added to each of our titles before it's
loaded into Mark Logic.
The taxonomy looks something like this:
<taxonomy>
<booktitle>Daily Lives of Civilians in Wartime Twentieth-Century
Europe</booktitle>
<booktitle_sort>Daily Lives of Civilians in Wartime Twentieth-Century
Europe</booktitle_sort>
...
<Authors>
<author authorId="130670">
<authorsort>Atkin, Nicholas</authorsort>
<firstname>Nicholas</firstname>
<middlename /><lastname>Atkin</lastname>
<role>Author</role><rank>1</rank>
</author>
</Authors>
</taxonomy>
There's an element-range-index on the authorsort and booktitle_sort
elements. There can be more than one author element.
And the query (so far) looks something like this:
for $v in cts:element-values(
xs:QName('authorsort'),
(), (),
cts:collection-query('abce'))
return
element heading {
attribute type { 'author'},
element name {$v},
let $titles :=
( cts:search(collection("abce")//taxonomy,
cts:element-value-query(xs:QName('authorsort'), $v), 'unfiltered') )
for $title in $titles
return element title {
attribute doc-id {$title/isbn13},
$title/booktitle}
}
This approach seems to work fairly well with the element range indexes on
our subject and date taxonomy elements, but is just too slow when it comes
to the authors.
Here's an excerpt from xdmp:query-trace:
xdmp:eval("(: browse testing :) xquery version
"1.0-ml";...", (), <options
xmlns="xdmp:eval"><database>7839305530622276384</database><modules>0</modules><def...</options>)
2009-07-17 05:13:42.584 Info: 8002-research: line 48: Analyzing path for
search: collection("abce")/descendant::taxonomy
2009-07-17 05:13:42.584 Info: 8002-research: line 48: Step 1 is searchable:
collection("abce")
2009-07-17 05:13:42.584 Info: 8002-research: line 48: Step 2 is searchable:
descendant::taxonomy
2009-07-17 05:13:42.584 Info: 8002-research: line 48: Path is fully
searchable.
2009-07-17 05:13:42.584 Info: 8002-research: line 48: Gathering constraints.
2009-07-17 05:13:42.584 Info: 8002-research: line 48: Step 1 contributed 1
constraint: collection("abce")
2009-07-17 05:13:42.584 Info: 8002-research: line 48: Step 2 test
contributed 1 constraint: taxonomy
2009-07-17 05:13:42.584 Info: 8002-research: line 48: Comparison contributed
string range value constraint: authorsort = "Zimmerman, Joseph F."
2009-07-17 05:13:42.584 Info: 8002-research: line 48: Search query
contributed 1 constraint: cts:element-range-query(QName("", "authorsort"),
"=", "Zimmerman, Joseph F.", ("collation=http://marklogic.com/collation/"),
1)
2009-07-17 05:13:42.584 Info: 8002-research: line 48: Executing search.
2009-07-17 05:13:42.584 Info: 8002-research: line 48: Selected 4 fragments
<qm:query-meters
xsi:schemaLocation="http://marklogic.com/xdmp/query-metersquery-meters.xsd"
xmlns:qm="
http://marklogic.com/xdmp/query-meters" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance">
<qm:elapsed-time>PT5.438S</qm:elapsed-time>
<qm:requests>0</qm:requests>
<qm:list-cache-hits>215013</qm:list-cache-hits>
<qm:list-cache-misses>0</qm:list-cache-misses>
<qm:in-memory-list-hits>0</qm:in-memory-list-hits>
<qm:expanded-tree-cache-hits>2205</qm:expanded-tree-cache-hits>
<qm:expanded-tree-cache-misses>4554</qm:expanded-tree-cache-misses>
<qm:compressed-tree-cache-hits>4554</qm:compressed-tree-cache-hits>
<qm:compressed-tree-cache-misses>0</qm:compressed-tree-cache-misses>
<qm:in-memory-compressed-tree-hits>0</qm:in-memory-compressed-tree-hits>
<qm:value-cache-hits>0</qm:value-cache-hits>
<qm:value-cache-misses>0</qm:value-cache-misses>
...
<qm:document>
<qm:uri>/abce/C9129.xml</qm:uri>
<qm:expanded-tree-cache-hits>0</qm:expanded-tree-cache-hits>
<qm:expanded-tree-cache-misses>1</qm:expanded-tree-cache-misses>
</qm:document>
I seem to be getting a lot of expanded-tree-cache-misses, but I'm not sure
how to correct for that.
Is there a more efficient way to generate our list of authors?
Thanks!
Susan
_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general