11 Dec
2011
11 Dec
'11
1:56 a.m.
Thanks for the explanation. So functions never use indices are the moment?
..unless the documents/database are specified within the function. For example, the following function will indeed be optimized, if the 'DB' database provides a text index: declare function($key as xs:string) { db:open('DB')//*[text() = $key] }; However, you can explicitly take advantage of a text index by using the db:text() function: declare function($db, $key) { db:text($db, $key)/.... }; Best, Christian