Ah okay, thanks.

That also explains other unsearchables that we were seeing after passing
variables to functions.

So does ML go back to disk in those xpath cases that are unrooted in the
database, or does it read from memory?  While I take your more useful
point about optimising the slow stuff, this is more a question for
understanding

Rachel


-----Original Message-----
From: Michael Blakeley <[email protected]>
Reply-To: MarkLogic Developer Discussion <[email protected]>
Date: Tuesday, 10 September 2013 17:51
To: MarkLogic Developer Discussion <[email protected]>
Subject: Re: [MarkLogic Dev General] Unsearchable text()

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



-----------------------------
http://www.bbc.co.uk
This e-mail (and any attachments) is confidential and
may contain personal views which are not the views of the BBC unless 
specifically stated.
If you have received it in
error, please delete it from your system.
Do not use, copy or disclose the
information in any way nor act in reliance on it and notify the sender
immediately.
Please note that the BBC monitors e-mails
sent or received.
Further communication will signify your consent to
this.
-----------------------------
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to