Reputation: 530
I have the following expression:
let $q1 := cts:element-range-query(xs:QName("ts:week"), ">=" ,xs:date("2009-04-25"))
return cts:search(fn:doc(), $q1, "unfiltered")
I did a xdmp:plan
, and got to know that range indexes are being used and the expression is searchable
However, when I added a XPath:
let $q1 := cts:element-range-query(xs:QName("ts:week"), ">=" ,xs:date("2009-04-25"))
return cts:search(fn:doc(), $q1, "unfiltered")/ts:top-song/ts:title/text()
On doing a xdmp:plan
, it told me the path is unsearchable. Further on doing in query-trace it said other than fn:doc()
nothing searchable.
However, since I am getting the correct result. My guess is that indexes are working just fine.
If so, what is logging the message "unsearchable" ?
I specifically need the title element in this case, is there anything I can do to make the entire expression searchable ?
Upvotes: 1
Views: 143
Reputation: 7335
This code is doing two things:
To put it another way, the XPath is not part of the search. It applies post-processing to the results of the search.
Both xdmp:estimate()
and xdmp:plan()
accept only the input to the search and not the post-processing on the results of the search.
Hoping that clarifies,
Upvotes: 3
Reputation: 66783
If there were an element range index on the ts:title
element, you could use cts:element-values()
to retrieve the titles by applying the $q1
query, and that would be an index-resolved operation.
For example:
cts:element-values(xs:QName("ts:title"), "", (), $q1)
Upvotes: 1