From c769150e1b4190eff8f38cfe40e02162e81cbf3e Mon Sep 17 00:00:00 2001 From: Adam Retter Date: Tue, 9 May 2023 18:07:05 +0200 Subject: [PATCH] [test] Fix the tests --- exist-core/src/test/xquery/indexing/range.xml | 22 +++---- .../src/test/xquery/optimizer/expressions.xqm | 66 +++++++++---------- .../src/test/xquery/optimizer/positional.xqm | 32 ++++----- .../lucene/src/test/xquery/lucene/queries.xml | 10 +-- .../src/test/xquery/range/conditions.xql | 66 +++++++++---------- .../range/src/test/xquery/range/fields.xql | 12 ++-- .../range/src/test/xquery/range/optimizer.xql | 66 +++++++++---------- .../range/src/test/xquery/range/types.xql | 22 +++---- 8 files changed, 148 insertions(+), 148 deletions(-) diff --git a/exist-core/src/test/xquery/indexing/range.xml b/exist-core/src/test/xquery/indexing/range.xml index 6fc3c6c8ba7..a4f1759ffae 100644 --- a/exist-core/src/test/xquery/indexing/range.xml +++ b/exist-core/src/test/xquery/indexing/range.xml @@ -78,35 +78,35 @@ Test empty element content doc("/db/test/text1.xml")//a[. = 'A1'] - //prof:index[@type = 'range'][@optimization = 2] + //prof:index[@type eq 'range'][@optimization-level eq 'OPTIMIZED'] Test empty element content doc("/db/test/text1.xml")//a[. = ''] - //prof:index[@type = 'range'][@optimization = 2] + //prof:index[@type eq 'range'][@optimization-level eq 'OPTIMIZED'] Simple query on xs:integer doc("/db/test/text1.xml")//b[. = 1] - //prof:index[@type = 'range'][@optimization = 2] + //prof:index[@type eq 'range'][@optimization-level eq 'OPTIMIZED'] Greater than on xs:integer doc("/db/test/text1.xml")//b[. > 1] - //prof:index[@type = 'range'][@optimization = 2] + //prof:index[@type eq 'range'][@optimization-level eq 'OPTIMIZED'] Greater than on xs:string doc("/db/test/text1.xml")//b[. > "1"] - //prof:index[@type = 'range'][@optimization = 2] + //prof:index[@type eq 'range'][@optimization-level eq 'OPTIMIZED'] @@ -119,42 +119,42 @@ Greater than on xs:double doc("/db/test/text1.xml")//c[. > xs:integer(1)] - //prof:index[@type = 'range'][@optimization = 2] + //prof:index[@type eq 'range'][@optimization-level eq 'OPTIMIZED'] Greater than on xs:double doc("/db/test/text1.xml")//c[. > 1.0] - //prof:index[@type = 'range'][@optimization = 2] + //prof:index[@type eq 'range'][@optimization-level eq 'OPTIMIZED'] Lookup xs:integer doc("/db/test/text1.xml")//d[. = 20] - //prof:index[@type = 'range'][@optimization = 2] + //prof:index[@type eq 'range'][@optimization-level eq 'OPTIMIZED'] Lookup xs:double on element containing numbers and strings doc("/db/test/text1.xml")//e[. = 50.0] - //prof:index[@type = 'range'][@optimization = 2] + //prof:index[@type eq 'range'][@optimization-level eq 'OPTIMIZED'] Compare xs:double on element containing numbers and strings doc("/db/test/text1.xml")//e[. > 50.0] - //prof:index[@type = 'range'][@optimization = 2] + //prof:index[@type eq 'range'][@optimization-level eq 'OPTIMIZED'] Query inside document constructor document { doc("/db/test/text1.xml")//b[. = 1] } - //prof:index[@type = 'range'][@optimization = 2] + //prof:index[@type eq 'range'][@optimization-level eq 'OPTIMIZED'] diff --git a/exist-core/src/test/xquery/optimizer/expressions.xqm b/exist-core/src/test/xquery/optimizer/expressions.xqm index 0e1ed1fc309..895108528ea 100755 --- a/exist-core/src/test/xquery/optimizer/expressions.xqm +++ b/exist-core/src/test/xquery/optimizer/expressions.xqm @@ -89,7 +89,7 @@ function ot:cleanup() { declare %test:stats %test:args("Rudi Rüssel") - %test:assertXPath("$result//stats:index[@type = 'range'][@optimization = 2]") + %test:assertXPath("$result//stats:index[@type eq 'range'][@optimization-level eq 'OPTIMIZED']") function ot:optimize-simple-comparison($name as xs:string) { collection($ot:COLLECTION)//address[name = $name]/city/text() }; @@ -97,7 +97,7 @@ function ot:optimize-simple-comparison($name as xs:string) { declare %test:stats %test:args("Rüsselsheim") - %test:assertXPath("$result//stats:index[@type = 'range'][@optimization = 0]") + %test:assertXPath("$result//stats:index[@type eq 'range'][@optimization-level eq 'NONE']") function ot:no-optimize-simple-comparison($name as xs:string) { collection($ot:COLLECTION)//address[city = $name]/city/text() }; @@ -105,7 +105,7 @@ function ot:no-optimize-simple-comparison($name as xs:string) { declare %test:stats %test:args("Rudi Rüssel") - %test:assertXPath("$result//stats:index[@type = 'range'][@optimization = 2]") + %test:assertXPath("$result//stats:index[@type eq 'range'][@optimization-level eq 'OPTIMIZED']") function ot:optimize-filter-context-step($name as xs:string) { collection($ot:COLLECTION)//(address)[name = $name]/city/text() }; @@ -113,7 +113,7 @@ function ot:optimize-filter-context-step($name as xs:string) { declare %test:stats %test:args("Rudi Rüssel") - %test:assertXPath("$result//stats:index[@type = 'range'][@optimization = 2]") + %test:assertXPath("$result//stats:index[@type eq 'range'][@optimization-level eq 'OPTIMIZED']") function ot:optimize-sequence($name as xs:string) { (collection($ot:COLLECTION)//address[name = $name]/city/text(), "xxx") }; @@ -121,7 +121,7 @@ function ot:optimize-sequence($name as xs:string) { declare %test:stats %test:args("Rudi Rüssel") - %test:assertXPath("$result//stats:index[@type = 'range'][@optimization = 2]") + %test:assertXPath("$result//stats:index[@type eq 'range'][@optimization-level eq 'OPTIMIZED']") function ot:optimize-let($name as xs:string) { let $city := collection($ot:COLLECTION)//address[name = $name]/city/text() return @@ -131,7 +131,7 @@ function ot:optimize-let($name as xs:string) { declare %test:stats %test:args("Rüsselsheim") - %test:assertXPath("$result//stats:index[@type = 'range'][@optimization = 0]") + %test:assertXPath("$result//stats:index[@type eq 'range'][@optimization-level eq 'NONE']") function ot:no-optimize-let($name as xs:string) { let $city := collection($ot:COLLECTION)//address[city = $name]/city/text() return @@ -141,7 +141,7 @@ function ot:no-optimize-let($name as xs:string) { declare %test:stats %test:args("Rudi Rüssel") - %test:assertXPath("$result//stats:index[@type = 'range'][@optimization = 2]") + %test:assertXPath("$result//stats:index[@type eq 'range'][@optimization-level eq 'OPTIMIZED']") function ot:optimize-for($name as xs:string) { for $city in collection($ot:COLLECTION)//address[name = $name]/city/text() return @@ -151,7 +151,7 @@ function ot:optimize-for($name as xs:string) { declare %test:stats %test:args("Rüsselsheim") - %test:assertXPath("$result//stats:index[@type = 'range'][@optimization = 0]") + %test:assertXPath("$result//stats:index[@type eq 'range'][@optimization-level eq 'NONE']") function ot:no-optimize-for($name as xs:string) { for $city in collection($ot:COLLECTION)//address[city = $name]/city/text() return @@ -161,7 +161,7 @@ function ot:no-optimize-for($name as xs:string) { declare %test:stats %test:args("Rudi Rüssel") - %test:assertXPath("$result//stats:index[@type = 'range'][@optimization = 2]") + %test:assertXPath("$result//stats:index[@type eq 'range'][@optimization-level eq 'OPTIMIZED']") function ot:optimize-if-then($name as xs:string) { if (1 = 1) then collection($ot:COLLECTION)//address[name = $name]/city/text() @@ -172,7 +172,7 @@ function ot:optimize-if-then($name as xs:string) { declare %test:stats %test:args("Rudi Rüssel") - %test:assertXPath("$result//stats:index[@type = 'range'][@optimization = 2]") + %test:assertXPath("$result//stats:index[@type eq 'range'][@optimization-level eq 'OPTIMIZED']") function ot:optimize-if-else($name as xs:string) { if (1 = 2) then () @@ -191,7 +191,7 @@ declare %private function ot:find-by-city($name as xs:string) { declare %test:stats %test:args("Rudi Rüssel") - %test:assertXPath("$result//stats:index[@type = 'range'][@optimization = 2]") + %test:assertXPath("$result//stats:index[@type eq 'range'][@optimization-level eq 'OPTIMIZED']") function ot:optimize-function-call($name as xs:string) { ot:find-by-name($name) }; @@ -199,7 +199,7 @@ function ot:optimize-function-call($name as xs:string) { declare %test:stats %test:args("Rudi Rüssel") - %test:assertXPath("$result//stats:index[@type = 'range'][@optimization = 2]") + %test:assertXPath("$result//stats:index[@type eq 'range'][@optimization-level eq 'OPTIMIZED']") function ot:no-optimize-function-call($name as xs:string) { ot:find-by-name($name) }; @@ -207,7 +207,7 @@ function ot:no-optimize-function-call($name as xs:string) { declare %test:stats %test:args("Rudi Rüssel") - %test:assertXPath("$result//stats:index[@type = 'range'][@optimization = 2]") + %test:assertXPath("$result//stats:index[@type eq 'range'][@optimization-level eq 'OPTIMIZED']") function ot:optimize-try($name as xs:string) { try { collection($ot:COLLECTION)//address[name = $name]/city/text() @@ -219,7 +219,7 @@ function ot:optimize-try($name as xs:string) { declare %test:stats %test:args("Rudi Rüssel") - %test:assertXPath("$result//stats:index[@type = 'range'][@optimization = 2]") + %test:assertXPath("$result//stats:index[@type eq 'range'][@optimization-level eq 'OPTIMIZED']") function ot:optimize-catch($name as xs:string) { try { xs:int("abc") @@ -231,7 +231,7 @@ function ot:optimize-catch($name as xs:string) { declare %test:stats %test:args("Rudi Rüssel") - %test:assertXPath("$result//stats:index[@type = 'range'][@optimization = 2]") + %test:assertXPath("$result//stats:index[@type eq 'range'][@optimization-level eq 'OPTIMIZED']") function ot:optimize-attribute-enclosed($name as xs:string) { }; @@ -239,7 +239,7 @@ function ot:optimize-attribute-enclosed($name as xs:string) { declare %test:stats %test:args("Rüsselsheim") - %test:assertXPath("$result//stats:index[@type = 'range'][@optimization = 0]") + %test:assertXPath("$result//stats:index[@type eq 'range'][@optimization-level eq 'NONE']") function ot:no-optimize-attribute-enclosed($name as xs:string) { }; @@ -247,7 +247,7 @@ function ot:no-optimize-attribute-enclosed($name as xs:string) { declare %test:stats %test:args("Rudi Rüssel") - %test:assertXPath("$result//stats:index[@type = 'range'][@optimization = 2]") + %test:assertXPath("$result//stats:index[@type eq 'range'][@optimization-level eq 'OPTIMIZED']") function ot:optimize-element-enclosed($name as xs:string) { {collection($ot:COLLECTION)//address[name = $name]/city/text()} }; @@ -255,7 +255,7 @@ function ot:optimize-element-enclosed($name as xs:string) { declare %test:stats %test:args("Rudi Rüssel") - %test:assertXPath("$result//stats:index[@type = 'range'][@optimization = 2]") + %test:assertXPath("$result//stats:index[@type eq 'range'][@optimization-level eq 'OPTIMIZED']") function ot:optimize-element-dynamic-enclosed($name as xs:string) { element a { collection($ot:COLLECTION)//address[name = $name]/city/text() @@ -265,7 +265,7 @@ function ot:optimize-element-dynamic-enclosed($name as xs:string) { declare %test:stats %test:args("Rudi Rüssel") - %test:assertXPath("$result//stats:index[@type = 'range'][@optimization = 2]") + %test:assertXPath("$result//stats:index[@type eq 'range'][@optimization-level eq 'OPTIMIZED']") function ot:optimize-attribute-dynamic-enclosed($name as xs:string) { { @@ -279,7 +279,7 @@ function ot:optimize-attribute-dynamic-enclosed($name as xs:string) { declare %test:stats %test:args("Rudi Rüssel") - %test:assertXPath("$result//stats:index[@type = 'range'][@optimization = 2]") + %test:assertXPath("$result//stats:index[@type eq 'range'][@optimization-level eq 'OPTIMIZED']") function ot:optimize-inline-function($name as xs:string) { let $f := function() { collection($ot:COLLECTION)//address[name = $name]/city/text() @@ -291,7 +291,7 @@ function ot:optimize-inline-function($name as xs:string) { declare %test:stats %test:args("Rudi Rüssel") - %test:assertXPath("$result//stats:index[@type = 'range'][@optimization = 2]") + %test:assertXPath("$result//stats:index[@type eq 'range'][@optimization-level eq 'OPTIMIZED']") function ot:optimize-inline-function-enclosed-attribute($name as xs:string) { let $f := function() { collection($ot:COLLECTION)//address[name = $name]/city/text() @@ -303,7 +303,7 @@ function ot:optimize-inline-function-enclosed-attribute($name as xs:string) { declare %test:stats %test:args("Rudi Rüssel") - %test:assertXPath("$result//stats:index[@type = 'range'][@optimization = 2]") + %test:assertXPath("$result//stats:index[@type eq 'range'][@optimization-level eq 'OPTIMIZED']") function ot:optimize-inline-function-enclosed($name as xs:string) { let $f := function() { collection($ot:COLLECTION)//address[name = $name]/city/text() @@ -315,7 +315,7 @@ function ot:optimize-inline-function-enclosed($name as xs:string) { declare %test:stats %test:args("Rudi Rüssel") - %test:assertXPath("$result//stats:index[@type = 'range'][@optimization = 2]") + %test:assertXPath("$result//stats:index[@type eq 'range'][@optimization-level eq 'OPTIMIZED']") function ot:optimize-function-reference($name as xs:string) { let $f := ot:find-by-name#1 return @@ -325,7 +325,7 @@ function ot:optimize-function-reference($name as xs:string) { declare %test:stats %test:args("Rudi Rüssel") - %test:assertXPath("$result//stats:index[@type = 'range'][@optimization = 2]") + %test:assertXPath("$result//stats:index[@type eq 'range'][@optimization-level eq 'OPTIMIZED']") function ot:optimize-function-map($name as xs:string) { let $f := ot:find-by-name#1 return @@ -335,7 +335,7 @@ function ot:optimize-function-map($name as xs:string) { declare %test:stats %test:args("Rudi Rüssel") - %test:assertXPath("$result//stats:index[@type = 'range'][@optimization = 2]") + %test:assertXPath("$result//stats:index[@type eq 'range'][@optimization-level eq 'OPTIMIZED']") function ot:optimize-function-partial($name as xs:string) { let $f1 := function($foo, $name) { ot:find-by-name($name) @@ -348,11 +348,11 @@ function ot:optimize-function-partial($name as xs:string) { declare %test:stats %test:args(1, "Rudi Rüssel") - %test:assertXPath("$result//stats:index[@type = 'range'][@optimization = 2]") + %test:assertXPath("$result//stats:index[@type eq 'range'][@optimization-level eq 'OPTIMIZED']") %test:args(2, "Rüsselsheim") - %test:assertXPath("$result//stats:index[@type = 'range'][@optimization = 0]") + %test:assertXPath("$result//stats:index[@type eq 'range'][@optimization-level eq 'NONE']") %test:args(3, "Rudi Rüssel") - %test:assertXPath("$result//stats:index[@type = 'range'][@optimization = 2]") + %test:assertXPath("$result//stats:index[@type eq 'range'][@optimization-level eq 'OPTIMIZED']") function ot:optimize-switch($case as xs:integer, $name as xs:string) { switch($case) case 1 return @@ -366,11 +366,11 @@ function ot:optimize-switch($case as xs:integer, $name as xs:string) { declare %test:stats %test:args("", "Rudi Rüssel") - %test:assertXPath("$result//stats:index[@type = 'range'][@optimization = 2]") + %test:assertXPath("$result//stats:index[@type eq 'range'][@optimization-level eq 'OPTIMIZED']") %test:args("", "Rüsselsheim") - %test:assertXPath("$result//stats:index[@type = 'range'][@optimization = 0]") + %test:assertXPath("$result//stats:index[@type eq 'range'][@optimization-level eq 'NONE']") %test:args("", "Rudi Rüssel") - %test:assertXPath("$result//stats:index[@type = 'range'][@optimization = 2]") + %test:assertXPath("$result//stats:index[@type eq 'range'][@optimization-level eq 'OPTIMIZED']") function ot:optimize-typeswitch($case as element(), $name as xs:string) { typeswitch($case) case element(a) return @@ -384,7 +384,7 @@ function ot:optimize-typeswitch($case as element(), $name as xs:string) { declare %test:stats %test:args("Rudi Rüssel") - %test:assertXPath("$result//stats:index[@type = 'range'][@optimization = 2]") + %test:assertXPath("$result//stats:index[@type eq 'range'][@optimization-level eq 'OPTIMIZED']") function ot:optimize-map($name as xs:string) { let $map := map { "key": collection($ot:COLLECTION)//address[name = $name]/city/text() @@ -396,7 +396,7 @@ function ot:optimize-map($name as xs:string) { declare %test:stats %test:args("Rudi Rüssel") - %test:assertXPath("$result//stats:index[@type = 'range'][@optimization = 2]") + %test:assertXPath("$result//stats:index[@type eq 'range'][@optimization-level eq 'OPTIMIZED']") function ot:optimize-map-entry($name as xs:string) { let $map := map:entry( "key", collection($ot:COLLECTION)//address[name = $name]/city/text() diff --git a/exist-core/src/test/xquery/optimizer/positional.xqm b/exist-core/src/test/xquery/optimizer/positional.xqm index 67734efe6a4..cdbbcd37fb0 100644 --- a/exist-core/src/test/xquery/optimizer/positional.xqm +++ b/exist-core/src/test/xquery/optimizer/positional.xqm @@ -106,7 +106,7 @@ function ot:simple-following() { declare %test:stats - %test:assertXPath("$result//stats:optimization[@type = 'PositionalPredicate']") + %test:assertXPath("$result//stats:optimization[@type eq 'POSITIONAL_PREDICATE']") function ot:optimize-simple-following() { let $w := doc($ot:DOC)//w[@xml:id='25000'] return @@ -123,7 +123,7 @@ function ot:simple-following-node() { declare %test:stats - %test:assertXPath("$result//stats:optimization[@type = 'PositionalPredicate']") + %test:assertXPath("$result//stats:optimization[@type eq 'POSITIONAL_PREDICATE']") function ot:optimize-simple-following-node() { let $w := doc($ot:DOC)//w[@xml:id='25000'] return @@ -132,7 +132,7 @@ function ot:optimize-simple-following-node() { declare %test:stats - %test:assertXPath("$result//stats:optimization[@type = 'PositionalPredicate']") + %test:assertXPath("$result//stats:optimization[@type eq 'POSITIONAL_PREDICATE']") function ot:optimize-simple-following-in-for() { let $w := doc($ot:DOC)//w[@xml:id='25000'] for $i in 1 to 3 @@ -150,7 +150,7 @@ function ot:simple-following-text() { declare %test:stats - %test:assertXPath("$result//stats:optimization[@type = 'PositionalPredicate']") + %test:assertXPath("$result//stats:optimization[@type eq 'POSITIONAL_PREDICATE']") function ot:optimize-simple-following-text() { let $w := doc($ot:DOC)//w[@xml:id='25000'] return @@ -167,7 +167,7 @@ function ot:simple-following-nested() { declare %test:stats - %test:assertXPath("$result//stats:optimization[@type = 'PositionalPredicate']") + %test:assertXPath("$result//stats:optimization[@type eq 'POSITIONAL_PREDICATE']") function ot:optimize-simple-following-nested() { let $w := doc($ot:DOC_NESTED)/test/*[1]/w[@xml:id='20'] return @@ -176,7 +176,7 @@ function ot:optimize-simple-following-nested() { declare %test:stats - %test:assertXPath("not($result//stats:optimization[@type = 'PositionalPredicate'])") + %test:assertXPath("not($result//stats:optimization[@type eq 'POSITIONAL_PREDICATE'])") function ot:optimize-simple-preceding() { let $w := doc($ot:DOC)//w[@xml:id='25000'] return @@ -185,7 +185,7 @@ function ot:optimize-simple-preceding() { declare %test:stats - %test:assertXPath("not($result//stats:optimization[@type = 'PositionalPredicate'])") + %test:assertXPath("not($result//stats:optimization[@type eq 'POSITIONAL_PREDICATE'])") function ot:optimize-simple-preceding-sibling() { let $w := doc($ot:DOC)//w[@xml:id='25000'] return @@ -194,7 +194,7 @@ function ot:optimize-simple-preceding-sibling() { declare %test:stats - %test:assertXPath("$result//stats:optimization[@type = 'PositionalPredicate']") + %test:assertXPath("$result//stats:optimization[@type eq 'POSITIONAL_PREDICATE']") function ot:optimize-simple-following-sibling() { let $w := doc($ot:DOC)//w[@xml:id='25000'] return @@ -203,7 +203,7 @@ function ot:optimize-simple-following-sibling() { declare %test:stats - %test:assertXPath("$result//stats:optimization[@type = 'PositionalPredicate']") + %test:assertXPath("$result//stats:optimization[@type eq 'POSITIONAL_PREDICATE']") function ot:optimize-following-multiple-filters() { let $w := doc($ot:DOC)//w[@xml:id='25000'] return @@ -212,7 +212,7 @@ function ot:optimize-following-multiple-filters() { declare %test:stats - %test:assertXPath("$result//stats:optimization[@type = 'PositionalPredicate']") + %test:assertXPath("$result//stats:optimization[@type eq 'POSITIONAL_PREDICATE']") function ot:optimize-following-filter-with-operator() { let $w := doc($ot:DOC)//w[@xml:id='25000'] for $i in 1 to 5 @@ -222,7 +222,7 @@ function ot:optimize-following-filter-with-operator() { declare %test:stats - %test:assertXPath("$result//stats:optimization[@type = 'PositionalPredicate']") + %test:assertXPath("$result//stats:optimization[@type eq 'POSITIONAL_PREDICATE']") function ot:optimize-following-filter-with-operator2() { let $w := doc($ot:DOC)//w[@xml:id='25000'] for $i in 1 to 5 @@ -241,7 +241,7 @@ function ot:optimize-following-filter-with-at() { declare %test:stats - %test:assertXPath("not($result//stats:optimization[@type = 'PositionalPredicate'])") + %test:assertXPath("not($result//stats:optimization[@type eq 'POSITIONAL_PREDICATE'])") function ot:no-optimize-following-filter-with-function() { let $w := doc($ot:DOC)//w[@xml:id='25000'] let $i := 1 @@ -252,7 +252,7 @@ function ot:no-optimize-following-filter-with-function() { declare %test:stats - %test:assertXPath("$result//stats:optimization[@type = 'PositionalPredicate']") + %test:assertXPath("$result//stats:optimization[@type eq 'POSITIONAL_PREDICATE']") function ot:optimize-following-filter-with-function() { let $w := doc($ot:DOC)//w[@xml:id='25000'] return @@ -261,7 +261,7 @@ function ot:optimize-following-filter-with-function() { declare %test:stats - %test:assertXPath("not($result//stats:optimization[@type = 'PositionalPredicate'])") + %test:assertXPath("not($result//stats:optimization[@type eq 'POSITIONAL_PREDICATE'])") function ot:optimize-following-filter-position() { let $w := doc($ot:DOC)//w[@xml:id='25000'] return @@ -270,7 +270,7 @@ function ot:optimize-following-filter-position() { declare %test:stats - %test:assertXPath("not($result//stats:optimization[@type = 'PositionalPredicate'])") + %test:assertXPath("not($result//stats:optimization[@type eq 'POSITIONAL_PREDICATE'])") function ot:optimize-following-filter-last() { let $w := doc($ot:DOC)//w[@xml:id='25000'] return @@ -279,7 +279,7 @@ function ot:optimize-following-filter-last() { declare %test:stats - %test:assertXPath("not($result//stats:optimization[@type = 'PositionalPredicate'])") + %test:assertXPath("not($result//stats:optimization[@type eq 'POSITIONAL_PREDICATE'])") function ot:optimize-following-nested-filter() { doc($ot:DOC)//w[@xml:id='25000'][following::*[1] = "25001"] }; diff --git a/extensions/indexes/lucene/src/test/xquery/lucene/queries.xml b/extensions/indexes/lucene/src/test/xquery/lucene/queries.xml index 965de6b46f2..b5d7f8eabf0 100644 --- a/extensions/indexes/lucene/src/test/xquery/lucene/queries.xml +++ b/extensions/indexes/lucene/src/test/xquery/lucene/queries.xml @@ -403,27 +403,27 @@ Query test: optimizer test, query on element doc("/db/lucene/text1.xml")//p[ft:query(b, "neun")] - $output/stats:index[@type = 'lucene']/@optimization = 2 + $output/stats:index[@type eq 'lucene']/@optimization-level eq 'OPTIMIZED' Query test: optimizer test, query on self doc("/db/lucene/text1.xml")//p[ft:query(., "acht")] - $output/stats:index[@type = 'lucene']/@optimization = 2 + $output/stats:index[@type eq 'lucene']/@optimization-level eq 'OPTIMIZED' Query test: optimizer test, query on wildcard doc("/db/lucene/text1.xml")/test[ft:query(*, "acht")] - $output/stats:index[@type = 'lucene']/@optimization = 2 + $output/stats:index[@type eq 'lucene']/@optimization-level eq 'OPTIMIZED' Optimizer test: wildcard context, self/descendant doc("/db/lucene/text1.xml")//x[ft:query(.//*, "nodes")] - $output/stats:index[@type = 'lucene']/@optimization = 2 + $output/stats:index[@type eq 'lucene']/@optimization-level eq 'OPTIMIZED' Optimizer test: wildcard context, long path doc("/db/lucene/text1.xml")//x[ft:query(./y/*, "nodes")] - $output/stats:index[@type = 'lucene']/@optimization = 2 + $output/stats:index[@type eq 'lucene']/@optimization-level eq 'OPTIMIZED' Phrase highlighting 1 diff --git a/extensions/indexes/range/src/test/xquery/range/conditions.xql b/extensions/indexes/range/src/test/xquery/range/conditions.xql index 1b60aae239a..a3951eac99f 100644 --- a/extensions/indexes/range/src/test/xquery/range/conditions.xql +++ b/extensions/indexes/range/src/test/xquery/range/conditions.xql @@ -218,16 +218,16 @@ function ct:cleanup() { (: the standard range lookup should not be used for the @type predicate :) declare %test:stats -%test:assertXPath("$result//stats:index[@type = 'new-range'][@optimization = 2] and not($result//stats:index[@type='range'])") +%test:assertXPath("$result//stats:index[@type eq 'new-range'][@optimization-level eq 'OPTIMIZED'] and not($result//stats:index[@type eq 'range'])") function ct:optimize-eq() { - collection($ct:COLLECTION)//tei:note[@type="availability"][.="publiziert"] + collection($ct:COLLECTION)//tei:note[@type eq "availability"][.="publiziert"] }; (: rewrite expression with predicate that matches a condition to a field :) (: the standard range lookup should not be used for the @type predicate :) declare %test:stats -%test:assertXPath("$result//stats:index[@type = 'new-range'][@optimization = 2] and not($result//stats:index[@type='range'])") +%test:assertXPath("$result//stats:index[@type eq 'new-range'][@optimization-level eq 'OPTIMIZED'] and not($result//stats:index[@type eq 'range'])") function ct:optimize-eq-numeric() { collection($ct:COLLECTION)//tei:num[@value = 1][.="publiziert"] }; @@ -236,14 +236,14 @@ function ct:optimize-eq-numeric() { (: the standard range lookup should not be used for the @type predicate :) declare %test:stats -%test:assertXPath("not($result//stats:index[@type = 'new-range'][@optimization = 2])") +%test:assertXPath("not($result//stats:index[@type eq 'new-range'][@optimization-level eq 'OPTIMIZED'])") function ct:no-optimize-eq-numeric() { collection($ct:COLLECTION)//tei:num[@value = "1"][.="publiziert"] }; declare %test:stats -%test:assertXPath("$result//stats:index[@type = 'new-range'][@optimization = 2] and not($result//stats:index[@type='range'])") +%test:assertXPath("$result//stats:index[@type eq 'new-range'][@optimization-level eq 'OPTIMIZED'] and not($result//stats:index[@type eq 'range'])") function ct:optimize-eq-var() { let $var := "availability" return collection($ct:COLLECTION)//tei:note[@type=$var][.="publiziert"] @@ -251,14 +251,14 @@ function ct:optimize-eq-var() { declare %test:stats -%test:assertXPath("$result//stats:index[@type = 'new-range'][@optimization = 2] and not($result//stats:index[@type='range'])") +%test:assertXPath("$result//stats:index[@type eq 'new-range'][@optimization-level eq 'OPTIMIZED'] and not($result//stats:index[@type eq 'range'])") function ct:optimize-eq-func() { collection($ct:COLLECTION)//tei:note[@type=lower-case("AVAILABILITY")][.="publiziert"] }; declare %test:stats -%test:assertXPath("$result//stats:index[@type = 'new-range'][@optimization = 2] and not($result//stats:index[@type='range'])") +%test:assertXPath("$result//stats:index[@type eq 'new-range'][@optimization-level eq 'OPTIMIZED'] and not($result//stats:index[@type eq 'range'])") function ct:optimize-eq-reverse-var-nested() { let $var := "availability" let $var2 := $var @@ -268,14 +268,14 @@ function ct:optimize-eq-reverse-var-nested() { declare variable $ct:var := "availability"; declare %test:stats -%test:assertXPath("$result//stats:index[@type = 'new-range'][@optimization = 2] and not($result//stats:index[@type='range'])") +%test:assertXPath("$result//stats:index[@type eq 'new-range'][@optimization-level eq 'OPTIMIZED'] and not($result//stats:index[@type eq 'range'])") function ct:optimize-eq-static-var() { collection($ct:COLLECTION)//tei:note[@type=$ct:var][.="publiziert"] }; declare %test:stats -%test:assertXPath("$result//stats:index[@type = 'new-range'][@optimization = 2] and not($result//stats:index[@type='range'])") +%test:assertXPath("$result//stats:index[@type eq 'new-range'][@optimization-level eq 'OPTIMIZED'] and not($result//stats:index[@type eq 'range'])") function ct:optimize-eq-reverse() { collection($ct:COLLECTION)//tei:note["availability" = @type][.="publiziert"] }; @@ -284,9 +284,9 @@ function ct:optimize-eq-reverse() { (: rewrite expression with predicate that matches a condition to a field :) declare %test:stats -%test:assertXPath("$result//stats:index[@type = 'new-range'][@optimization = 2] and not($result//stats:index[@type='range'])") +%test:assertXPath("$result//stats:index[@type eq 'new-range'][@optimization-level eq 'OPTIMIZED'] and not($result//stats:index[@type eq 'range'])") function ct:optimize-eq2() { - collection($ct:COLLECTION)//tei:note[@type="orig_place"][tei:place/tei:placeName eq "Oxyrhynchos"] + collection($ct:COLLECTION)//tei:note[@type eq "orig_place"][tei:place/tei:placeName eq "Oxyrhynchos"] }; @@ -299,9 +299,9 @@ count(range:index-keys-for-field("pCase", function($k, $n) { $k }, 10)) declare %test:stats -%test:assertXPath("not($result//stats:index[@type = 'new-range'][@optimization = 2])") +%test:assertXPath("not($result//stats:index[@type eq 'new-range'][@optimization-level eq 'OPTIMIZED'])") function ct:optimize-case() { -collection($ct:COLLECTION)//tei:note[@type="Availablity"][.="publiziert"] +collection($ct:COLLECTION)//tei:note[@type eq "Availablity"][.="publiziert"] }; declare @@ -313,9 +313,9 @@ range:index-keys-for-field("exactlyOne", function($k, $n) { $k }, 10) (: do not use a conditional field for optimizing if condition does not match :) declare %test:stats -%test:assertXPath("not($result//stats:index[@type = 'new-range'][@optimization = 2])") +%test:assertXPath("not($result//stats:index[@type eq 'new-range'][@optimization-level eq 'OPTIMIZED'])") function ct:no-optimize-condition2() { -collection($ct:COLLECTION)//tei:note[@type="something"][. = "literarisch"] +collection($ct:COLLECTION)//tei:note[@type eq "something"][. = "literarisch"] }; (: only the elements matching the condition should have been indexed :) @@ -329,7 +329,7 @@ count(collection($ct:COLLECTION)//range:field-eq("text_type", "literarisch")) (: some have not, pick the one without condition if no condition matches :) declare %test:stats -%test:assertXPath("$result//stats:index[@type = 'new-range'][@optimization = 2]") +%test:assertXPath("$result//stats:index[@type eq 'new-range'][@optimization-level eq 'OPTIMIZED']") function ct:use-config-without-condition-optimize() { collection($ct:COLLECTION)//tei:note[.="foo"] }; @@ -343,16 +343,16 @@ count(collection($ct:COLLECTION)//tei:note[.="foo"]) (: rewrite expression with multiple conditions to the correct field :) declare %test:stats -%test:assertXPath("$result//stats:index[@type = 'new-range'][@optimization = 2][@calls = 1] and not($result//stats:index[@type='range'])") +%test:assertXPath("$result//stats:index[@type eq 'new-range'][@optimization-level eq 'OPTIMIZED'][@calls = 1] and not($result//stats:index[@type eq 'range'])") function ct:multiple-conditions() { -collection($ct:COLLECTION)//tei:placeName[@cert="high"][@type="someType"][.="Achmim"] +collection($ct:COLLECTION)//tei:placeName[@cert="high"][@type eq "someType"][.="Achmim"] }; declare %test:stats -%test:assertXPath("$result//stats:index[@type = 'new-range'][@optimization = 2][@calls = 1] and $result//stats:index[@type='range'][@calls=1]") +%test:assertXPath("$result//stats:index[@type eq 'new-range'][@optimization-level eq 'OPTIMIZED'][@calls = 1] and $result//stats:index[@type eq 'range'][@calls=1]") function ct:multiple-conditions-inbetween() { -collection($ct:COLLECTION)//tei:placeName[@cert="high"][not(.="")][@type="someType"][.="Achmim"] +collection($ct:COLLECTION)//tei:placeName[@cert="high"][not(.="")][@type eq "someType"][.="Achmim"] }; @@ -364,7 +364,7 @@ range:index-keys-for-field("text_type_end", function($k, $n) { $k }, 10) declare %test:stats -%test:assertXPath("$result//stats:index[@type = 'new-range'][@optimization = 2] and not($result//stats:index[@type='range'])") +%test:assertXPath("$result//stats:index[@type eq 'new-range'][@optimization-level eq 'OPTIMIZED'] and not($result//stats:index[@type eq 'range'])") function ct:optimize-ends-with() { collection($ct:COLLECTION)//tei:note[ends-with(@type, "end")][. = "startswithendswith"] }; @@ -377,7 +377,7 @@ range:index-keys-for-field("text_type_start", function($k, $n) { $k }, 10) declare %test:stats -%test:assertXPath("$result//stats:index[@type = 'new-range'][@optimization = 2] and not($result//stats:index[@type='range'])") +%test:assertXPath("$result//stats:index[@type eq 'new-range'][@optimization-level eq 'OPTIMIZED'] and not($result//stats:index[@type eq 'range'])") function ct:optimize-starts-with() { collection($ct:COLLECTION)//tei:note[starts-with(@type, "start")][. = "startswithendswith"] }; @@ -390,21 +390,21 @@ range:index-keys-for-field("termsBeforeB", function($k, $n) { $k }, 10) declare %test:stats -%test:assertXPath("$result//stats:index[@type = 'new-range'][@optimization = 2] and not($result//stats:index[@type='range'])") +%test:assertXPath("$result//stats:index[@type eq 'new-range'][@optimization-level eq 'OPTIMIZED'] and not($result//stats:index[@type eq 'range'])") function ct:optimize-lt() { collection($ct:COLLECTION)//tei:term[@n < "b"][. = "eins"] }; declare %test:stats -%test:assertXPath("$result//stats:index[@type = 'new-range'][@optimization = 2] and not($result//stats:index[@type='range'])") +%test:assertXPath("$result//stats:index[@type eq 'new-range'][@optimization-level eq 'OPTIMIZED'] and not($result//stats:index[@type eq 'range'])") function ct:optimize-lt-numeric() { collection($ct:COLLECTION)//tei:figure[@n < 2][. = "one"] }; declare %test:stats -%test:assertXPath("not($result//stats:index[@type = 'new-range'][@optimization = 2])") +%test:assertXPath("not($result//stats:index[@type eq 'new-range'][@optimization-level eq 'OPTIMIZED'])") function ct:no-optimize-lt-numeric() { collection($ct:COLLECTION)//tei:figure[@n < "2"][. = "one"] }; @@ -430,14 +430,14 @@ range:index-keys-for-field("termsAfterB", function($k, $n) { $k }, 10) declare %test:stats -%test:assertXPath("$result//stats:index[@type = 'new-range'][@optimization = 2] and not($result//stats:index[@type='range'])") +%test:assertXPath("$result//stats:index[@type eq 'new-range'][@optimization-level eq 'OPTIMIZED'] and not($result//stats:index[@type eq 'range'])") function ct:optimize-gt() { collection($ct:COLLECTION)//tei:term[@n > "b"][. = "drei"] }; declare %test:stats -%test:assertXPath("$result//stats:index[@type = 'new-range'][@optimization = 2] and not($result//stats:index[@type='range'])") +%test:assertXPath("$result//stats:index[@type eq 'new-range'][@optimization-level eq 'OPTIMIZED'] and not($result//stats:index[@type eq 'range'])") function ct:optimize-gt-inverse() { collection($ct:COLLECTION)//tei:term["b" < @n][. = "eins"] }; @@ -462,7 +462,7 @@ range:index-keys-for-field("termsBeforeOrEqualB", function($k, $n) { $k }, 10) declare %test:stats -%test:assertXPath("$result//stats:index[@type = 'new-range'][@optimization = 2] and not($result//stats:index[@type='range'])") +%test:assertXPath("$result//stats:index[@type eq 'new-range'][@optimization-level eq 'OPTIMIZED'] and not($result//stats:index[@type eq 'range'])") function ct:optimize-le() { collection($ct:COLLECTION)//tei:term[@n le "b"][. = "eins"] }; @@ -481,7 +481,7 @@ range:index-keys-for-field("termsAfterOrEqualB", function($k, $n) { $k }, 10) declare %test:stats -%test:assertXPath("$result//stats:index[@type = 'new-range'][@optimization = 2] and not($result//stats:index[@type='range'])") +%test:assertXPath("$result//stats:index[@type eq 'new-range'][@optimization-level eq 'OPTIMIZED'] and not($result//stats:index[@type eq 'range'])") function ct:optimize-ge() { collection($ct:COLLECTION)//tei:term[@n ge "b"][. = "drei"] }; @@ -495,7 +495,7 @@ range:index-keys-for-field("termsNotB", function($k, $n) { $k }, 10) declare %test:stats -%test:assertXPath("$result//stats:index[@type = 'new-range'][@optimization = 2] and not($result//stats:index[@type='range'])") +%test:assertXPath("$result//stats:index[@type eq 'new-range'][@optimization-level eq 'OPTIMIZED'] and not($result//stats:index[@type eq 'range'])") function ct:optimize-ne() { collection($ct:COLLECTION)//tei:term[@n ne "b"][. = "drei"] }; @@ -508,7 +508,7 @@ range:index-keys-for-field("entryNContains1234", function($k, $n) { $k }, 10) declare %test:stats -%test:assertXPath("$result//stats:index[@type = 'new-range'][@optimization = 2] and not($result//stats:index[@type='range'])") +%test:assertXPath("$result//stats:index[@type eq 'new-range'][@optimization-level eq 'OPTIMIZED'] and not($result//stats:index[@type eq 'range'])") function ct:optimize-contains() { collection($ct:COLLECTION)//tei:entry[contains(@n, "1234")][. = "something"] }; @@ -521,14 +521,14 @@ range:index-keys-for-field("entryNMatches", function($k, $n) { $k }, 10) declare %test:stats -%test:assertXPath("$result//stats:index[@type = 'new-range'][@optimization = 2] and not($result//stats:index[@type='range'])") +%test:assertXPath("$result//stats:index[@type eq 'new-range'][@optimization-level eq 'OPTIMIZED'] and not($result//stats:index[@type eq 'range'])") function ct:optimize-matches() { collection($ct:COLLECTION)//tei:entry[matches(@n, "some_\d+_thing")][. = "something"] }; declare %test:stats -%test:assertXPath("$result//stats:index[@type = 'new-range'][@optimization = 2] and not($result//stats:index[@type='range'])") +%test:assertXPath("$result//stats:index[@type eq 'new-range'][@optimization-level eq 'OPTIMIZED'] and not($result//stats:index[@type eq 'range'])") function ct:optimize-matches-no-case() { collection($ct:COLLECTION)//tei:p[matches(@type, "bb")][. = "something"] }; diff --git a/extensions/indexes/range/src/test/xquery/range/fields.xql b/extensions/indexes/range/src/test/xquery/range/fields.xql index 55b5421e183..781f03448d8 100755 --- a/extensions/indexes/range/src/test/xquery/range/fields.xql +++ b/extensions/indexes/range/src/test/xquery/range/fields.xql @@ -118,7 +118,7 @@ function rt:field-div-eq($id as xs:string) { declare %test:stats %test:args("sha-mac101") - %test:assertXPath("$result//stats:index[@type = 'new-range'][@optimization = 2]") + %test:assertXPath("$result//stats:index[@type eq 'new-range'][@optimization-level eq 'OPTIMIZED']") function rt:field-div-eq-optimize($id as xs:string) { count(collection($rt:COLLECTION)//tei:div[@xml:id = $id]) }; @@ -126,7 +126,7 @@ function rt:field-div-eq-optimize($id as xs:string) { declare %test:stats %test:args("sha-mac101005") - %test:assertXPath("not($result//stats:index[@type = 'new-range'][@optimization = 2])") + %test:assertXPath("not($result//stats:index[@type eq 'new-range'][@optimization-level eq 'OPTIMIZED'])") function rt:field-l-eq-optimize-no($id as xs:string) { collection($rt:COLLECTION)//tei:sp/tei:l[@xml:id = $id] }; @@ -134,7 +134,7 @@ function rt:field-l-eq-optimize-no($id as xs:string) { declare %test:stats %test:args("sha-mac101005") - %test:assertXPath("$result//stats:index[@type = 'new-range'][@optimization = 2]") + %test:assertXPath("$result//stats:index[@type eq 'new-range'][@optimization-level eq 'OPTIMIZED']") function rt:field-l-eq-optimize($id as xs:string) { collection($rt:COLLECTION)//tei:div[tei:sp/tei:l/@xml:id = $id] }; @@ -158,7 +158,7 @@ function rt:field-speaker-eq($id as xs:string) { declare %test:stats %test:args("First Witch") - %test:assertXPath("$result//stats:index[@type = 'new-range'][@optimization = 2]") + %test:assertXPath("$result//stats:index[@type eq 'new-range'][@optimization-level eq 'OPTIMIZED']") function rt:field-speaker-eq-optimize($id as xs:string) { count(collection($rt:COLLECTION)//tei:div[tei:sp/tei:speaker = $id]) }; @@ -173,7 +173,7 @@ function rt:field-stage-eq($stage as xs:string) { declare %test:stats %test:args("Enter three Witches.") - %test:assertXPath("$result//stats:index[@type = 'new-range'][@optimization = 2]") + %test:assertXPath("$result//stats:index[@type eq 'new-range'][@optimization-level eq 'OPTIMIZED']") function rt:field-stage-eq-optimize($stage as xs:string) { count(collection($rt:COLLECTION)//tei:div[tei:stage = $stage]) }; @@ -195,7 +195,7 @@ function rt:field-head-ends-with($head as xs:string) { declare %test:stats %test:args("Scene 1") - %test:assertXPath("$result//stats:index[@type = 'new-range'][@optimization = 2]") + %test:assertXPath("$result//stats:index[@type eq 'new-range'][@optimization-level eq 'OPTIMIZED']") function rt:field-head-ends-with-optimize($head as xs:string) { count(collection($rt:COLLECTION)//tei:div[ends-with(tei:head, $head)]) }; diff --git a/extensions/indexes/range/src/test/xquery/range/optimizer.xql b/extensions/indexes/range/src/test/xquery/range/optimizer.xql index cac8d3c8984..ddaf78590ce 100644 --- a/extensions/indexes/range/src/test/xquery/range/optimizer.xql +++ b/extensions/indexes/range/src/test/xquery/range/optimizer.xql @@ -180,7 +180,7 @@ function ot:cleanup() { declare %test:stats %test:args("Rudi Rüssel") - %test:assertXPath("$result//stats:index[@type = 'new-range'][@optimization = 2]") + %test:assertXPath("$result//stats:index[@type eq 'new-range'][@optimization-level eq 'OPTIMIZED']") function ot:optimize-eq-string($name as xs:string) { collection($ot:COLLECTION)//address[name = $name] }; @@ -188,7 +188,7 @@ function ot:optimize-eq-string($name as xs:string) { declare %test:stats %test:args("Rudi Rüssel") - %test:assertXPath("$result//stats:index[@type = 'new-range'][@optimization = 2]") + %test:assertXPath("$result//stats:index[@type eq 'new-range'][@optimization-level eq 'OPTIMIZED']") function ot:optimize-ne-string($name as xs:string) { collection($ot:COLLECTION)//address[name != $name] }; @@ -196,7 +196,7 @@ function ot:optimize-ne-string($name as xs:string) { declare %test:stats %test:args("Rudi Rüssel") - %test:assertXPath("$result//stats:index[@type = 'new-range'][@optimization = 2]") + %test:assertXPath("$result//stats:index[@type eq 'new-range'][@optimization-level eq 'OPTIMIZED']") function ot:optimize-ne-string2($name as xs:string) { collection($ot:COLLECTION)//address[name ne $name] }; @@ -204,7 +204,7 @@ function ot:optimize-ne-string2($name as xs:string) { declare %test:stats %test:args("Rudi Rüssel") - %test:assertXPath("$result//stats:index[@type = 'new-range'][@optimization = 2]") + %test:assertXPath("$result//stats:index[@type eq 'new-range'][@optimization-level eq 'OPTIMIZED']") function ot:optimize-ne-string-self($name as xs:string) { collection($ot:COLLECTION)//address/name[. ne $name] }; @@ -212,7 +212,7 @@ function ot:optimize-ne-string-self($name as xs:string) { declare %test:stats %test:args("Rudi") - %test:assertXPath("$result//stats:index[@type = 'new-range'][@optimization = 2]") + %test:assertXPath("$result//stats:index[@type eq 'new-range'][@optimization-level eq 'OPTIMIZED']") function ot:optimize-starts-with-string($name as xs:string) { collection($ot:COLLECTION)//address[starts-with(name, $name)] }; @@ -220,7 +220,7 @@ function ot:optimize-starts-with-string($name as xs:string) { declare %test:stats %test:args("Rüssel") - %test:assertXPath("$result//stats:index[@type = 'new-range'][@optimization = 2]") + %test:assertXPath("$result//stats:index[@type eq 'new-range'][@optimization-level eq 'OPTIMIZED']") function ot:optimize-ends-with-string($name as xs:string) { collection($ot:COLLECTION)//address[ends-with(name, $name)] }; @@ -228,7 +228,7 @@ function ot:optimize-ends-with-string($name as xs:string) { declare %test:stats %test:args("udi ") - %test:assertXPath("$result//stats:index[@type = 'new-range'][@optimization = 2]") + %test:assertXPath("$result//stats:index[@type eq 'new-range'][@optimization-level eq 'OPTIMIZED']") function ot:optimize-contains-string($name as xs:string) { collection($ot:COLLECTION)//address[contains(name, $name)] }; @@ -236,7 +236,7 @@ function ot:optimize-contains-string($name as xs:string) { declare %test:stats %test:args("[rR]udi .*") - %test:assertXPath("$result//stats:index[@type = 'new-range'][@optimization = 2]") + %test:assertXPath("$result//stats:index[@type eq 'new-range'][@optimization-level eq 'OPTIMIZED']") function ot:optimize-matches-string($name as xs:string) { collection($ot:COLLECTION)//address[range:matches(name, $name)] }; @@ -244,7 +244,7 @@ function ot:optimize-matches-string($name as xs:string) { declare %test:stats %test:args("[rR]udi .*") - %test:assertXPath("$result//stats:index[@type = 'new-range'][@optimization = 1]") + %test:assertXPath("$result//stats:index[@type eq 'new-range'][@optimization-level eq 'BASIC']") function ot:optimize-matches-string-filtered($name as xs:string) { let $address := collection($ot:COLLECTION)//address return @@ -254,7 +254,7 @@ function ot:optimize-matches-string-filtered($name as xs:string) { declare %test:stats %test:args("Rudi Rüssel") - %test:assertXPath("$result//stats:index[@type = 'new-range'][@optimization = 2]") + %test:assertXPath("$result//stats:index[@type eq 'new-range'][@optimization-level eq 'OPTIMIZED']") function ot:optimize-eq-string-self($name as xs:string) { collection($ot:COLLECTION)//address/name[. = $name] }; @@ -270,7 +270,7 @@ function ot:eq-string-self-filtered($name as xs:string) { declare %test:stats %test:args(65428) - %test:assertXPath("$result//stats:index[@type = 'new-range'][@optimization = 2]") + %test:assertXPath("$result//stats:index[@type eq 'new-range'][@optimization-level eq 'OPTIMIZED']") function ot:optimize-eq-int-attribute($code as xs:integer) { collection($ot:COLLECTION)//address/city[@code = $code] }; @@ -278,7 +278,7 @@ function ot:optimize-eq-int-attribute($code as xs:integer) { declare %test:stats %test:args("Rudi Rüssel") - %test:assertXPath("$result//stats:index[@type = 'new-range'][@optimization = 2]") + %test:assertXPath("$result//stats:index[@type eq 'new-range'][@optimization-level eq 'OPTIMIZED']") function ot:optimize-lt-string($name as xs:string) { collection($ot:COLLECTION)//address[name < $name] }; @@ -307,7 +307,7 @@ function ot:lt-string($name as xs:string) { declare %test:stats %test:args("Rudi Rüssel") - %test:assertXPath("$result//stats:index[@type = 'new-range'][@optimization = 2]") + %test:assertXPath("$result//stats:index[@type eq 'new-range'][@optimization-level eq 'OPTIMIZED']") function ot:optimize-le-string($name as xs:string) { collection($ot:COLLECTION)//address[name <= $name] }; @@ -322,7 +322,7 @@ function ot:le-string($name as xs:string) { declare %test:stats %test:args("Rudi Rüssel") - %test:assertXPath("$result//stats:index[@type = 'new-range'][@optimization = 2]") + %test:assertXPath("$result//stats:index[@type eq 'new-range'][@optimization-level eq 'OPTIMIZED']") function ot:optimize-gt-string($name as xs:string) { collection($ot:COLLECTION)//address[name > $name] }; @@ -337,7 +337,7 @@ function ot:gt-string($name as xs:string) { declare %test:stats %test:args("Rudi Rüssel") - %test:assertXPath("$result//stats:index[@type = 'new-range'][@optimization = 2]") + %test:assertXPath("$result//stats:index[@type eq 'new-range'][@optimization-level eq 'OPTIMIZED']") function ot:optimize-ge-string($name as xs:string) { collection($ot:COLLECTION)//address[name > $name] }; @@ -352,7 +352,7 @@ function ot:ge-string($name as xs:string) { declare %test:stats %test:args("Rüsselsheim") - %test:assertXPath("$result//stats:index[@type = 'new-range'][@optimization = 2]") + %test:assertXPath("$result//stats:index[@type eq 'new-range'][@optimization-level eq 'OPTIMIZED']") function ot:optimize-eq-field($city as xs:string) { collection($ot:COLLECTION)//address[city = $city] }; @@ -367,7 +367,7 @@ function ot:eq-field($city as xs:string) { declare %test:stats %test:args("Rüsselsheim") - %test:assertXPath("$result//stats:index[@type = 'new-range'][@optimization = 2]") + %test:assertXPath("$result//stats:index[@type eq 'new-range'][@optimization-level eq 'OPTIMIZED']") function ot:optimize-ne-field($city as xs:string) { collection($ot:COLLECTION)//address[city != $city] }; @@ -382,7 +382,7 @@ function ot:ne-field($city as xs:string) { declare %test:stats %test:args("Rüsselsheim") - %test:assertXPath("$result//stats:index[@type = 'new-range'][@optimization = 2]") + %test:assertXPath("$result//stats:index[@type eq 'new-range'][@optimization-level eq 'OPTIMIZED']") function ot:optimize-gt-field($city as xs:string) { collection($ot:COLLECTION)//address[city > $city] }; @@ -397,7 +397,7 @@ function ot:gt-field($city as xs:string) { declare %test:stats %test:args("Rüsselsheim") - %test:assertXPath("$result//stats:index[@type = 'new-range'][@optimization = 2]") + %test:assertXPath("$result//stats:index[@type eq 'new-range'][@optimization-level eq 'OPTIMIZED']") function ot:optimize-ge-field($city as xs:string) { collection($ot:COLLECTION)//address[city >= $city] }; @@ -412,7 +412,7 @@ function ot:ge-field($city as xs:string) { declare %test:stats %test:args("Rüsselsheim") - %test:assertXPath("$result//stats:index[@type = 'new-range'][@optimization = 2]") + %test:assertXPath("$result//stats:index[@type eq 'new-range'][@optimization-level eq 'OPTIMIZED']") function ot:optimize-lt-field($city as xs:string) { collection($ot:COLLECTION)//address[city < $city] }; @@ -427,7 +427,7 @@ function ot:lt-field($city as xs:string) { declare %test:stats %test:args("Rüsselsheim") - %test:assertXPath("$result//stats:index[@type = 'new-range'][@optimization = 2]") + %test:assertXPath("$result//stats:index[@type eq 'new-range'][@optimization-level eq 'OPTIMIZED']") function ot:optimize-le-field($city as xs:string) { collection($ot:COLLECTION)//address[city <= $city] }; @@ -442,7 +442,7 @@ function ot:le-field($city as xs:string) { declare %test:stats %test:args("Rüssel") - %test:assertXPath("$result//stats:index[@type = 'new-range'][@optimization = 2]") + %test:assertXPath("$result//stats:index[@type eq 'new-range'][@optimization-level eq 'OPTIMIZED']") function ot:optimize-starts-with-field($city as xs:string) { collection($ot:COLLECTION)//address[starts-with(city, $city)] }; @@ -450,7 +450,7 @@ function ot:optimize-starts-with-field($city as xs:string) { declare %test:stats %test:args("heim") - %test:assertXPath("$result//stats:index[@type = 'new-range'][@optimization = 2]") + %test:assertXPath("$result//stats:index[@type eq 'new-range'][@optimization-level eq 'OPTIMIZED']") function ot:optimize-ends-with-field($city as xs:string) { collection($ot:COLLECTION)//address[ends-with(city, $city)] }; @@ -458,7 +458,7 @@ function ot:optimize-ends-with-field($city as xs:string) { declare %test:stats %test:args("üssel") - %test:assertXPath("$result//stats:index[@type = 'new-range'][@optimization = 2]") + %test:assertXPath("$result//stats:index[@type eq 'new-range'][@optimization-level eq 'OPTIMIZED']") function ot:optimize-contains-field($city as xs:string) { collection($ot:COLLECTION)//address[contains(city, $city)] }; @@ -466,7 +466,7 @@ function ot:optimize-contains-field($city as xs:string) { declare %test:stats %test:args("[rR]üssel.*") - %test:assertXPath("$result//stats:index[@type = 'new-range'][@optimization = 2]") + %test:assertXPath("$result//stats:index[@type eq 'new-range'][@optimization-level eq 'OPTIMIZED']") function ot:optimize-matches-field($city as xs:string) { collection($ot:COLLECTION)//address[range:matches(city, $city)] }; @@ -482,7 +482,7 @@ function ot:matches-field-filtered($city as xs:string) { declare %test:stats %test:args("Rüsselsheim", "Elefantenweg 67") - %test:assertXPath("$result//stats:index[@type = 'new-range'][@optimization = 2]") + %test:assertXPath("$result//stats:index[@type eq 'new-range'][@optimization-level eq 'OPTIMIZED']") function ot:optimize-eq-field-multi($city as xs:string, $street as xs:string) { collection($ot:COLLECTION)//address[city = $city][street = $street] }; @@ -506,7 +506,7 @@ function ot:eq-field-multi-filtered($city as xs:string, $street as xs:string) { declare %test:stats %test:args("Rüsselsheim", "Elefantenweg 67") - %test:assertXPath("$result//stats:index[@type = 'new-range'][@optimization = 2]") + %test:assertXPath("$result//stats:index[@type eq 'new-range'][@optimization-level eq 'OPTIMIZED']") function ot:optimize-mixed-op-field($city as xs:string, $street as xs:string) { collection($ot:COLLECTION)//address[city > $city][street = $street] }; @@ -528,7 +528,7 @@ function ot:mixed-op-field2($city as xs:string, $street as xs:string) { declare %test:stats %test:args("Rüsselsheim", "Elefantenweg 67") - %test:assertXPath("$result//stats:index[@type = 'new-range'][@optimization = 2]") + %test:assertXPath("$result//stats:index[@type eq 'new-range'][@optimization-level eq 'OPTIMIZED']") function ot:no-optimize-field-multi($city as xs:string, $street as xs:string) { collection($ot:COLLECTION)//address[street = $street][1] }; @@ -536,7 +536,7 @@ function ot:no-optimize-field-multi($city as xs:string, $street as xs:string) { declare %test:stats %test:args("berta@milchview.org") - %test:assertXPath("$result//stats:index[@type = 'new-range'][@optimization = 2]") + %test:assertXPath("$result//stats:index[@type eq 'new-range'][@optimization-level eq 'OPTIMIZED']") function ot:optimize-eq-field-nested($email as xs:string) { collection($ot:COLLECTION)//address[contact/email = $email] }; @@ -544,7 +544,7 @@ function ot:optimize-eq-field-nested($email as xs:string) { declare %test:stats %test:args("berta@milchview.org") - %test:assertXPath("$result//stats:index[@type = 'new-range'][@optimization = 2]") + %test:assertXPath("$result//stats:index[@type eq 'new-range'][@optimization-level eq 'OPTIMIZED']") function ot:optimize-lt-field-nested($email as xs:string) { collection($ot:COLLECTION)//address[contact/email < $email] }; @@ -563,7 +563,7 @@ function ot:equality-field-nested($type as xs:string, $subtype as xs:string, $na declare %test:stats %test:args("main", "official", "Hofthiergarten") - %test:assertXPath("$result//stats:index[@type = 'new-range'][@optimization = 2]") + %test:assertXPath("$result//stats:index[@type eq 'new-range'][@optimization-level eq 'OPTIMIZED']") function ot:optimize-field-self($type as xs:string, $subtype as xs:string, $name as xs:string) { collection($ot:COLLECTION)//tei:placeName[@type = $type][@subtype = $subtype][. = $name]/text() }; @@ -576,7 +576,7 @@ function ot:parent-attr-equals() { declare %test:stats - %test:assertXPath("$result//stats:index[@type = 'range'][@optimization = 0]") + %test:assertXPath("$result//stats:index[@type eq 'range'][@optimization-level eq 'NONE']") function ot:optimize-parent-attr-equals() { collection($ot:COLLECTION)//name[parent::address/@id = "rüssel"]/text() }; @@ -589,7 +589,7 @@ function ot:parent-nested-attr-equals() { declare %test:stats - %test:assertXPath("$result//stats:index[@type = 'range'][@optimization = 0]") + %test:assertXPath("$result//stats:index[@type eq 'range'][@optimization-level eq 'NONE']") function ot:optimize-parent-nested-attr-equals() { collection($ot:COLLECTION)//name[parent::address[@id = "rüssel"]]/text() }; diff --git a/extensions/indexes/range/src/test/xquery/range/types.xql b/extensions/indexes/range/src/test/xquery/range/types.xql index 2ece6bc2de8..d13c7c64872 100644 --- a/extensions/indexes/range/src/test/xquery/range/types.xql +++ b/extensions/indexes/range/src/test/xquery/range/types.xql @@ -135,7 +135,7 @@ function tt:eq-date($date as xs:date) { declare %test:stats %test:args("2012-01-20") - %test:assertXPath("$result//stats:index[@type = 'new-range'][@optimization = 2]") + %test:assertXPath("$result//stats:index[@type eq 'new-range'][@optimization-level eq 'OPTIMIZED']") function tt:eq-date-optimize($date as xs:date) { collection($tt:COLLECTION)//entry[date = $date] }; @@ -152,7 +152,7 @@ function tt:eq-date-type-conversion($date as xs:string) { declare %test:stats %test:args("2012-01-20") - %test:assertXPath("$result//stats:index[@type = 'new-range'][@optimization = 2]") + %test:assertXPath("$result//stats:index[@type eq 'new-range'][@optimization-level eq 'OPTIMIZED']") function tt:eq-date-type-conversion-optimize($date as xs:string) { collection($tt:COLLECTION)//entry[date = $date] }; @@ -169,7 +169,7 @@ function tt:eq-date-field($date as xs:date) { declare %test:stats %test:args("2012-01-20") - %test:assertXPath("$result//stats:index[@type = 'new-range'][@optimization = 2]") + %test:assertXPath("$result//stats:index[@type eq 'new-range'][@optimization-level eq 'OPTIMIZED']") function tt:eq-date-field-optimize($date as xs:date) { collection($tt:COLLECTION)//entry[date2 = $date] }; @@ -186,7 +186,7 @@ function tt:eq-date-field-type-conversion($date as xs:string) { declare %test:stats %test:args("2012-01-20") - %test:assertXPath("$result//stats:index[@type = 'new-range'][@optimization = 2]") + %test:assertXPath("$result//stats:index[@type eq 'new-range'][@optimization-level eq 'OPTIMIZED']") function tt:eq-date-field-type-conversion-optimize($date as xs:string) { collection($tt:COLLECTION)//entry[date2 = $date] }; @@ -205,7 +205,7 @@ function tt:gt-date($date as xs:date) { declare %test:stats %test:args("2012-01-20") - %test:assertXPath("$result//stats:index[@type = 'new-range'][@optimization = 2]") + %test:assertXPath("$result//stats:index[@type eq 'new-range'][@optimization-level eq 'OPTIMIZED']") function tt:gt-date-optimize($date as xs:date) { collection($tt:COLLECTION)//entry[date > $date]/id/string() }; @@ -224,7 +224,7 @@ function tt:gt-date-field($date as xs:date) { declare %test:stats %test:args("2012-01-20") - %test:assertXPath("$result//stats:index[@type = 'new-range'][@optimization = 2]") + %test:assertXPath("$result//stats:index[@type eq 'new-range'][@optimization-level eq 'OPTIMIZED']") function tt:gt-date-field-optimize($date as xs:date) { collection($tt:COLLECTION)//entry[date2 > $date]/id/string() }; @@ -243,7 +243,7 @@ function tt:lt-date($date as xs:date) { declare %test:stats %test:args("2012-01-20") - %test:assertXPath("$result//stats:index[@type = 'new-range'][@optimization = 2]") + %test:assertXPath("$result//stats:index[@type eq 'new-range'][@optimization-level eq 'OPTIMIZED']") function tt:lt-date-optimize($date as xs:date) { collection($tt:COLLECTION)//entry[date < $date]/id/string() }; @@ -262,7 +262,7 @@ function tt:lt-date-field($date as xs:date) { declare %test:stats %test:args("2012-01-20") - %test:assertXPath("$result//stats:index[@type = 'new-range'][@optimization = 2]") + %test:assertXPath("$result//stats:index[@type eq 'new-range'][@optimization-level eq 'OPTIMIZED']") function tt:lt-date-field-optimize($date as xs:date) { collection($tt:COLLECTION)//entry[date2 < $date]/id/string() }; @@ -279,7 +279,7 @@ function tt:eq-time($time as xs:time) { declare %test:stats %test:args("10:00:00Z") - %test:assertXPath("$result//stats:index[@type = 'new-range'][@optimization = 2]") + %test:assertXPath("$result//stats:index[@type eq 'new-range'][@optimization-level eq 'OPTIMIZED']") function tt:eq-time-optimize($time as xs:time) { collection($tt:COLLECTION)//entry[time = $time]/id/string() }; @@ -312,7 +312,7 @@ function tt:eq-dateTime($dateTime as xs:dateTime) { declare %test:stats %test:args("2012-01-20T10:00:00Z") - %test:assertXPath("$result//stats:index[@type = 'new-range'][@optimization = 2]") + %test:assertXPath("$result//stats:index[@type eq 'new-range'][@optimization-level eq 'OPTIMIZED']") function tt:eq-dateTime-optimize($dateTime as xs:dateTime) { collection($tt:COLLECTION)//entry[dateTime = $dateTime]/id/string() }; @@ -366,7 +366,7 @@ function tt:int-field-wrong-type($n as xs:string) { declare %test:stats %test:args("up") - %test:assertXPath("$result//stats:index[@type = 'new-range'][@optimization = 2]") + %test:assertXPath("$result//stats:index[@type eq 'new-range'][@optimization-level eq 'OPTIMIZED']") function tt:string-contains-optimized($string as xs:string) { collection($tt:COLLECTION)//entry[contains(string, $string)]/id/string() };