24 Mar
2022
24 Mar
'22
7:02 p.m.
Hi Jonathan, You can create databases that contain key/value pairs: let $words := <words>{ for $i in 1 to 10 return <word n='{ $i }'>{ format-integer($i, 'w') }</word> }</words> return db:create('words', $words, 'words.xml') If you look up values in that database … for $n in (1 to 10) ! string() return db:open('words')//word[@n = $n] ! data() … the text index will be utilized, and your query will be rewritten as follows: (1 to 10) ! data(db:attribute("words", string(.))/ self::attribute(n)/parent::word) If you don’t want to rely on the rewritings of the query optimizer, you can directly use db:attribute. Best, Christian