Hi,
I have a query which is optimized in a curious way in BaseX 9.0.2 (yesterday's snapshot).
This is the original query:
xquery version "3.1";
declare namespace tei = "http://www.tei-c.org/ns/1.0";
let $string := "string"
let $fuzzy := false()
return (
collection('ZK')/tei:TEI[
if (false())
then (.[descendant::text() contains text {$string} using fuzzy])
else (.[descendant::text() contains text {$string}])
],
collection('ZK')/tei:TEI[
if ($fuzzy)
then (.[descendant::text() contains text {$string} using fuzzy])
else (.[descendant::text() contains text {$string}])
]
)
And this is the optimized one (newlines inserted by me for better readability):
(
ft:search("ZK", "string" using language 'English')/ancestor::tei:TEI[parent::document-node()],
ft:search("ZK", "string" using fuzzy using language 'English')/ancestor::tei:TEI[parent::document-node()]
)
I'm curious why the second search is using fuzzy, even though the
variable $fuzzy is false. I presume that query optimization is
independent of the data, so you won't need the data to reproduce.
But if you do, I can provide it. A database with enabled full-text
index is required obviously.Best regards,
Sebastian Zimmer
Cologne Center for
eHumanities
DH Center at the University of Cologne
@CCeHum