Hi Christian,
When I run your script, I do get 14 elements.
When I run the following script I just get 12.
<commands> <set option='ftindex'>true</set> <create-db name='factbook'>https://files.basex.org/xml/factbook.xml </create-db> <xquery><![CDATA[ declare function local:search( $database as xs:string, $query as xs:string ) { let $country-search := ft:search($database, $query)/ancestor::country let $city-search := ft:search($database, $query)/ancestor::city/ancestor::country let $other-search := ft:search($database, $query)/parent::*[name() = ('ethnicgroups', 'languages')]/ancestor::country let $country-mark := $country-search[.//name[text() contains text { $query }]] => ft:mark() let $city-mark := $city-search[.//city[text() contains text { $query }]] => ft:mark() let $other-mark := $other-search[.//*[name() = ('ethnicgroups', 'languages')][text() contains text { $query }]] => ft:mark() return ( $country-mark, $city-mark, $other-mark ) };
local:search('factbook', 'German')//mark ]]></xquery> </commands>
When you say you can't reproduce it, do you mean you get 14 results from running this script?
Cheers,
Jack
On Thu, 29 Feb 2024, 1:02 am Christian Grün, christian.gruen@gmail.com wrote:
Hi Jack,
Thanks for your observation.
The first result of this query is the entry for Austria. I would expect both of the instances of the word 'German' in that entry to be surrounded by <mark> tags. However only the first instance is.
I couldn’t reproduce this yet. Here’s a command script that returns 14 <mark>German</mark> elements:
<commands> <set option='ftindex'>true</set> <create-db name='factbook'>https://files.basex.org/xml/factbook.xml </create-db> <xquery><![CDATA[ let $groups := ('ethnicgroups', 'languages') let $database := 'factbook' let $query := 'German'
let $search := ft:search($database, $query)/parent::* [name() = $groups]/ancestor::country let $marked := ft:mark( $search[.//*[name() = $groups][text() contains text { $query }]] ) return $marked//*[text() = 'German'] ]]></xquery>
</commands>
Could you check if you get the same result?
Thanks in advance Christian