Full-text document and queries. @author BaseX Team, BSD License @author Christian Gruen
| 9 | * @author Christian Gruen |
| 10 | */ |
| 11 | abstract class FTTest extends QueryTest { |
| 12 | /** Test document. */ |
| 13 | protected static final String DOC = """ |
| 14 | <fttest> |
| 15 | <co> |
| 16 | <w>xml in the first sentence. second sentence. |
| 17 | third sentence. fourth sentence. fifth sentence.</w> |
| 18 | <w>XML xml XmL</w> |
| 19 | <w>we have xml databases</w> |
| 20 | <w>XML DATABASES</w> |
| 21 | <w>XML & Databases</w> |
| 22 | </co> |
| 23 | <wc> |
| 24 | <w>hello</w> |
| 25 | </wc> |
| 26 | <sc> |
| 27 | <s>di\u00e4t-joghurt</s> |
| 28 | <s>diat-joghurt</s> |
| 29 | </sc> |
| 30 | <at><b>B</b>ad one</at> |
| 31 | <fti>adfas wordt. ook wel eens</fti> |
| 32 | <fti>wordt ook wel een s</fti> |
| 33 | <fti>adfad. wordt |
| 34 | ook wel.eens a</fti> |
| 35 | <fti>adfad wordt. ook |
| 36 | wel een s adf</fti> |
| 37 | <fti>adfad wordt ook. wel een s</fti> |
| 38 | <atr key='value'/> |
| 39 | <w>the fifth sentence. fourth sentence. |
| 40 | third sentence. second sentence. first sentence.</w> |
| 41 | <wld/> |
| 42 | <wld>yeah</wld> |
| 43 | <mix>A<sub/>B</mix> |
| 44 | <mix>B<sub/>A</mix> |
| 45 | <order>A B A</order> |
| 46 | </fttest>"""; |
| 47 | |
| 48 | static { create(DOC); } |
| 49 | |
| 50 | /** Test queries. */ |
| 51 | protected static final Object[][] QUERIES = { |
| 52 | { "Simple 1", booleans(true), "'a' contains text 'a'" }, |
| 53 | { "Simple 2", booleans(true), "'a b' contains text 'b'" }, |
| 54 | { "Simple 3", booleans(false), "'abc' contains text 'b'" }, |
| 55 | { "Simple 4", nodes(22), "//b['true' contains text 'true']" }, |
| 56 | { "Simple 5", booleans(true), "//@key contains text 'value'" }, |
| 57 | { "Simple 6", strings("value"), "//@key[. contains text 'value']/string()" }, |
| 58 | { "Simple 7", booleans(false), "//@key contains text 'values'" }, |
| 59 | { "Simple 8", booleans(true), "number('100') + 23 contains text '123'" }, |
| 60 | { "Simple 9", booleans(true), "true() contains text 'true'" }, |
| 61 | { "Simple 10", booleans(true), "false() contains text 'false'" }, |
| 62 | { "Simple 11", booleans(false), "'text' contains text ''" }, |
| 63 | { "Simple 12", booleans(false), "'t' contains text ftnot { 't' } distance at most 0 words" }, |
| 64 | |
| 65 | { "FT 1", nodes(14), "//w[text() contains text 'HELLO']" }, |
| 66 | { "FT 2", nodes(14), "//w[text() contains text 'hello']" }, |
| 67 | { "FT 3", nodes(14), "//w[text() contains text ' hello!... ']" }, |
| 68 | { "FT 4", emptySequence(), "//w[ text ( ) contains text ' anarmophism ' ] " }, |
nothing calls this directly
no test coverage detected