It isn't the text(), it's the FLWOR.

Searchable expressions are XPath expressions that are rooted in the database. 
An expression like $foo/bar is never searchable, because the XPath is relative 
to a variable rather than rooted in the database. So the expression to assign 
$documentProperties is searchable, but $modifiedBy is not. And that's ok.

Now, you could rewrite this to be fully searchable - but I wouldn't.

    xdmp:document-properties($uri)/prop:properties/prop:modifiedBy

That search will check for prop:properties and prop:modifiedBy as well as the 
URI. But this is a doc() lookup, so the URI is the most useful part. Every 
property fragment will have prop:properties, and presumably in your application 
prop:modifiedBy will be ubiquitous.

Making all your expressions searchable is not a worthwhile goal, and usually 
impossible anyway. Optimize the slow stuff.

If this code needs optimization at all, I would try to merge the repeated calls 
to doc(). That might be difficult to arrange, but a tight loop of doc() calls 
can be expensive. Something like doc($uris) is cheaper: 1 database lookup 
instead of N. But that assumes you can get the same results without doing too 
many backflips.

-- Mike

On 10 Sep 2013, at 04:30 , Rachel Wilson <[email protected]> wrote:

> In the ErrorLog output we see  "Step 4 is unsearchable: text()"  for any 
> property we retrieve with "text()" as follows:
> 
> Eg.
> 
> for $documentUri in $uris
>     let $documentProperties := xdmp:document-properties($documentUri)
>     let $modifiedBy := 
> $documentProperties/prop:properties/prop:modifiedBy/text()
> 

_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to