Hi everyone! it's me again.
Here is my doubt:
If I execute this query:
(# db:enforceindex #) {
for $db in ('US00','US01','US02')
for $tmUS in db:open($db)/trademark-applications-daily/application-information/file-segments/action-keys/case-file
where $tmUS/case-file-header/mark-identification/text() contains text { 'apple' }
return $tmUS/case-file-header/mark-identification/text()
}
I get 4k results in 139ms from three databases of 90GB and 13M of records. It works like a charm. [01]
But, if I include that query into a for and then into a switch ( I tried with if-then-else too ), the same query returns only 11 results in 107ms [02]:
let $text := "apple"
let $registries := ('US')
for $registry in $registries
return
switch ($registry)
case "US"
return
(# db:enforceindex #) {
for $db in ('US00','US01','US02')
for $tmUS in db:open($db)/trademark-applications-daily/application-information/file-segments/action-keys/case-file
where $tmUS/case-file-header/mark-identification/text() contains text { $text }
return $tmUS/case-file-header/mark-identification/text()
}
case "GB"
return
(# db:enforceindex #) {
for $tmGB in db:open('GB')/gb:MarkLicenceeExportList/gb:TradeMark
where $tmGB/gb:WordMarkSpecification/gb:MarkVerbalElementText/text() contains text { $text }
return $tmGB/gb:WordMarkSpecification/gb:MarkVerbalElementText/text()
}
default return "Unknown registry code"
I noticed that removing the case option "GB" ( even if it's not evaluated ), it works fine and returns the 4k records [03]:
let $text := "apple"
let $registries := ('US')
for $registry in $registries
return
switch ($registry)
case "US"
return
(# db:enforceindex #) {
for $db in ('US00','US01','US02')
for $tmUS in db:open($db)/trademark-applications-daily/application-information/file-segments/action-keys/case-file
where $tmUS/case-file-header/mark-identification/text() contains text { $text }
return $tmUS/case-file-header/mark-identification/text()
}
default return "Unknown registry code"
What I'm missing here? is this the right behaviour?
Best regards,
Sebastian