Mattio,
Since you are using 4.1, you might want to try the new search API
(http://developer.marklogic.com/pubs/4.1/apidocs/SearchAPI.html). It
reduces the paginated-search tutorial to a search:search() function
call, with a better parser implementation. It also provides result
snippets and other extra features.
But let's talk about that XDMP-ORDERBYVAL error. As specified by the
W3C, XQuery 'order by' sub-expressions can only order by 0-1 values at a
time (see http://www.w3.org/TR/xquery/#id-orderby-return especially the
first bullet describing the orderspecs evaluation). So I suspect that
you have more than one booktitle_sort value per $i node.
Here's a simple test case that illustrates the problem:
let $list := (
<p><val>1</val></p>,
<p><val>2</val><val>3</val></p>
)
for $i in $list
order by $i/val
return $i
=>
[1.0-ml] XDMP-ORDERBYVAL: order by $i/val ascending -- Invalid 'order
by' value (<val>2</val>, <val>3</val>)
We can limit the order-by to make this work:
let $list := (
<p><val>1</val></p>,
<p><val>2</val><val>3</val></p>
)
for $i in $list
order by $i/val[1]
return $i
...but that might not return the results you want. In practice, I find
that it's often best to specifically create a single element for each
sort-key, and ensure that it is always unique within the scope of my
'order by' operations.
-- Mike
On 2009-07-12 12:41, Mattio Valentino wrote:
I have two different MarkLogic 4.1 installations. The first has a
very small subset of content. The second has the full set of content.
I'm adding sorting functionality similar to what is outlined in this
article: http://dev.marklogic.com/howto/tutorials/2006-09-paginated-search.xqy.
When I run the query via cq on the small subset, everything works as
expected. When I run the same query on the full set of content, I get
the following error:
[1.0-ml] XDMP-ORDERBYVAL: order by $i/taxonomy/booktitle_sort --
Invalid 'order by' value
Both installations have an element range index defined on booktitle_sort.
What would cause this error? I thought I had documents missing the
value, but when I exclude them from the cts:search, I get the same
error.
Thanks,
Mattio
_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general
_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general