]>
Commit | Line | Data |
---|---|---|
f3c0d7a5 A |
1 | // © 2016 and later: Unicode, Inc. and others. |
2 | // License & terms of use: http://www.unicode.org/copyright.html | |
b75a7d8f | 3 | /******************************************************************** |
b331163b | 4 | * Copyright (c) 2001-2011,2015 International Business Machines |
b75a7d8f A |
5 | * Corporation and others. All Rights Reserved. |
6 | ******************************************************************** | |
7 | * File USRCHDAT.H | |
8 | * Modification History: | |
9 | * Name date Description | |
10 | * synwee July 31 2001 creation | |
11 | ********************************************************************/ | |
12 | ||
46f4442e A |
13 | |
14 | /* | |
15 | Note: This file is included by other C and C++ files. This file should not be directly compiled. | |
16 | */ | |
b75a7d8f A |
17 | #ifndef USRCHDAT_C |
18 | #define USRCHDAT_C | |
19 | ||
46f4442e | 20 | #include "unicode/ucol.h" |
b75a7d8f A |
21 | |
22 | #if !UCONFIG_NO_COLLATION | |
23 | ||
46f4442e A |
24 | /* Set to 1 if matches must be on grapheme boundaries */ |
25 | #define GRAPHEME_BOUNDARIES 1 | |
b75a7d8f | 26 | |
46f4442e | 27 | U_CDECL_BEGIN |
b75a7d8f A |
28 | struct SearchData { |
29 | const char *text; | |
30 | const char *pattern; | |
729e4ab9 | 31 | const char *collator; /* currently supported "fr" "es" "de", plus NULL/other => "en" */ |
b75a7d8f | 32 | UCollationStrength strength; |
729e4ab9 A |
33 | USearchAttributeValue elemCompare; /* value for the USEARCH_ELEMENT_COMPARISON attribute */ |
34 | const char *breaker; /* currently supported "wordbreaker" for EN_WORDBREAKER_, plus NULL/other => EN_CHARACTERBREAKER_ */ | |
46f4442e A |
35 | int8_t offset[32]; |
36 | uint8_t size[32]; | |
b75a7d8f | 37 | }; |
46f4442e | 38 | U_CDECL_END |
b75a7d8f A |
39 | |
40 | typedef struct SearchData SearchData; | |
41 | ||
42 | static const char *TESTCOLLATORRULE = "& o,O ; p,P"; | |
43 | ||
44 | static const char *EXTRACOLLATIONRULE = " & ae ; \\u00e4 & AE ; \\u00c4 & oe ; \\u00f6 & OE ; \\u00d6 & ue ; \\u00fc & UE ; \\u00dc"; | |
45 | ||
46 | static const SearchData BASIC[] = { | |
729e4ab9 A |
47 | {"xxxxxxxxxxxxxxxxxxxx", "fisher", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}}, |
48 | {"silly spring string", "string", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {13, -1}, | |
b75a7d8f | 49 | {6}}, |
729e4ab9 | 50 | {"silly spring string string", "string", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, |
b75a7d8f | 51 | {13, 20, -1}, {6, 6}}, |
729e4ab9 | 52 | {"silly string spring string", "string", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, |
b75a7d8f | 53 | {6, 20, -1}, {6, 6}}, |
729e4ab9 | 54 | {"string spring string", "string", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {0, 14, -1}, |
b75a7d8f | 55 | {6, 6}}, |
729e4ab9 A |
56 | {"Scott Ganyo", "c", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {1, -1}, {1}}, |
57 | {"Scott Ganyo", " ", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {5, -1}, {1}}, | |
58 | {"\\u0300\\u0325", "\\u0300", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}}, | |
59 | {"a\\u0300\\u0325", "\\u0300", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}}, | |
46f4442e A |
60 | |
61 | #if GRAPHEME_BOUNDARIES | |
729e4ab9 A |
62 | {"a\\u0300\\u0325", "\\u0300\\u0325", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}}, |
63 | {"a\\u0300b", "\\u0300", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}}, | |
46f4442e | 64 | #else |
729e4ab9 A |
65 | {"a\\u0300\\u0325", "\\u0300\\u0325", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {1, -1}, {2}}, |
66 | {"a\\u0300b", "\\u0300", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {1, -1}, {1}}, | |
46f4442e A |
67 | #endif |
68 | ||
729e4ab9 | 69 | {"\\u00c9", "e", NULL, UCOL_PRIMARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {0, -1}, {1}}, |
4388f060 | 70 | {"x a\\u0301", "a\\u0301", NULL, UCOL_PRIMARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {2, -1}, {2}}, |
729e4ab9 | 71 | {NULL, NULL, NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}} |
b75a7d8f A |
72 | }; |
73 | ||
74 | static const SearchData BREAKITERATOREXACT[] = { | |
729e4ab9 | 75 | {"foxy fox", "fox", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, "characterbreaker", {0, 5, -1}, |
b75a7d8f | 76 | {3, 3}}, |
729e4ab9 A |
77 | {"foxy fox", "fox", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, "wordbreaker", {5, -1}, {3}}, |
78 | {"This is a toe T\\u00F6ne", "toe", "de", UCOL_PRIMARY, USEARCH_STANDARD_ELEMENT_COMPARISON, | |
b75a7d8f | 79 | "characterbreaker", {10, 14, -1}, {3, 2}}, |
729e4ab9 | 80 | {"This is a toe T\\u00F6ne", "toe", "de", UCOL_PRIMARY, USEARCH_STANDARD_ELEMENT_COMPARISON, "wordbreaker", |
b75a7d8f A |
81 | {10, -1}, {3}}, |
82 | {"Channel, another channel, more channels, and one last Channel", | |
729e4ab9 | 83 | "Channel", "es", UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, "wordbreaker", {0, 54, -1}, {7, 7}}, |
b75a7d8f | 84 | /* jitterbug 1745 */ |
729e4ab9 | 85 | {"testing that \\u00e9 does not match e", "e", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, |
b75a7d8f A |
86 | "characterbreaker", {1, 17, 30, -1}, {1, 1, 1}}, |
87 | {"testing that string ab\\u00e9cd does not match e", "e", NULL, | |
729e4ab9 A |
88 | UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, "characterbreaker", {1, 28, 41, -1}, {1, 1, 1}}, |
89 | {"\\u00c9", "e", "fr", UCOL_PRIMARY, USEARCH_STANDARD_ELEMENT_COMPARISON, "characterbreaker", {0, -1}, {1}}, | |
46f4442e A |
90 | #if 0 |
91 | /* Problem reported by Dave Bertoni, same as ticket 4279? */ | |
729e4ab9 | 92 | {"\\u0043\\u004F\\u0302\\u0054\\u00C9", "\\u004F", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, "characterbreaker", {1, -1}, {2}}, |
46f4442e | 93 | #endif |
729e4ab9 A |
94 | {NULL, NULL, NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}} |
95 | }; | |
96 | ||
97 | #define PECHE_WITH_ACCENTS "un p\\u00E9ch\\u00E9, " \ | |
98 | "\\u00E7a p\\u00E8che par, " \ | |
99 | "p\\u00E9cher, " \ | |
100 | "une p\\u00EAche, " \ | |
101 | "un p\\u00EAcher, " \ | |
102 | "j\\u2019ai p\\u00EAch\\u00E9, " \ | |
103 | "un p\\u00E9cheur, " \ | |
104 | "\\u201Cp\\u00E9che\\u201D, " \ | |
105 | "decomp peche\\u0301, " \ | |
106 | "base peche" | |
107 | /* in the above, the interesting words and their offsets are: | |
108 | 3 pe<301>che<301> | |
109 | 13 pe<300>che | |
110 | 24 pe<301>cher | |
111 | 36 pe<302>che | |
112 | 46 pe<302>cher | |
113 | 59 pe<302>che<301> | |
114 | 69 pe<301>cheur | |
115 | 79 pe<301>che | |
116 | 94 peche<+301> | |
117 | 107 peche | |
118 | */ | |
b75a7d8f A |
119 | |
120 | static const SearchData STRENGTH[] = { | |
729e4ab9 A |
121 | /*012345678901234567890123456789012345678901234567890123456789*/ |
122 | /*00*/{"The quick brown fox jumps over the lazy foxes", "fox", "en", | |
123 | UCOL_PRIMARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {16, 40, -1}, {3, 3}}, | |
124 | /*01*/{"The quick brown fox jumps over the lazy foxes", "fox", "en", | |
125 | UCOL_PRIMARY, USEARCH_STANDARD_ELEMENT_COMPARISON, "wordbreaker", {16, -1}, {3}}, | |
126 | /*02*/{"blackbirds Pat p\\u00E9ch\\u00E9 p\\u00EAche p\\u00E9cher p\\u00EAcher Tod T\\u00F6ne black Tofu blackbirds Ton PAT toehold blackbird black-bird pat toe big Toe", | |
127 | "peche", "fr", UCOL_PRIMARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {15, 21, 27, 34, -1}, {5, 5, 5, 5}}, | |
128 | /*03*/{"This is a toe T\\u00F6ne", "toe", "de", UCOL_PRIMARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, | |
129 | {10, 14, -1}, {3, 2}}, | |
130 | /*04*/{"A channel, another CHANNEL, more Channels, and one last channel...", | |
131 | "channel", "es", UCOL_PRIMARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {2, 19, 33, 56, -1}, {7, 7, 7, 7}}, | |
132 | /*05*/{"\\u00c0 should match but not A", "A\\u0300", "en", UCOL_IDENTICAL, USEARCH_STANDARD_ELEMENT_COMPARISON, | |
133 | NULL, {0, -1}, {1, 0}}, | |
134 | /* some tests for modified element comparison, ticket #7093 */ | |
135 | /*06*/{PECHE_WITH_ACCENTS, "peche", "en", UCOL_PRIMARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {3, 13, 24, 36, 46, 59, 69, 79, 94, 107, -1}, {5, 5, 5, 5, 5, 5, 5, 5, 6, 5}}, | |
136 | /*07*/{PECHE_WITH_ACCENTS, "peche", "en", UCOL_PRIMARY, USEARCH_STANDARD_ELEMENT_COMPARISON, "wordbreaker", {3, 13, 36, 59, 79, 94, 107, -1}, {5, 5, 5, 5, 5, 6, 5}}, | |
137 | /*08*/{PECHE_WITH_ACCENTS, "peche", "en", UCOL_SECONDARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {107, -1}, {5}}, | |
138 | /*09*/{PECHE_WITH_ACCENTS, "peche", "en", UCOL_SECONDARY, USEARCH_PATTERN_BASE_WEIGHT_IS_WILDCARD, NULL, {3, 13, 24, 36, 46, 59, 69, 79, 94, 107, -1}, {5, 5, 5, 5, 5, 5, 5, 5, 6, 5}}, | |
139 | /*10*/{PECHE_WITH_ACCENTS, "peche", "en", UCOL_SECONDARY, USEARCH_PATTERN_BASE_WEIGHT_IS_WILDCARD, "wordbreaker", {3, 13, 36, 59, 79, 94, 107, -1}, {5, 5, 5, 5, 5, 6, 5}}, | |
140 | /*11*/{PECHE_WITH_ACCENTS, "p\\u00E9che", "en", UCOL_SECONDARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {24, 69, 79, -1}, {5, 5, 5}}, | |
141 | /*12*/{PECHE_WITH_ACCENTS, "p\\u00E9che", "en", UCOL_SECONDARY, USEARCH_STANDARD_ELEMENT_COMPARISON, "wordbreaker", {79, -1}, {5}}, | |
142 | /*13*/{PECHE_WITH_ACCENTS, "p\\u00E9che", "en", UCOL_SECONDARY, USEARCH_PATTERN_BASE_WEIGHT_IS_WILDCARD, NULL, {3, 24, 69, 79, -1}, {5, 5, 5, 5}}, | |
143 | /*14*/{PECHE_WITH_ACCENTS, "p\\u00E9che", "en", UCOL_SECONDARY, USEARCH_PATTERN_BASE_WEIGHT_IS_WILDCARD, "wordbreaker", {3, 79, -1}, {5, 5}}, | |
144 | /*15*/{PECHE_WITH_ACCENTS, "p\\u00E9che", "en", UCOL_SECONDARY, USEARCH_ANY_BASE_WEIGHT_IS_WILDCARD, NULL, {3, 24, 69, 79, 94, 107, -1}, {5, 5, 5, 5, 6, 5}}, | |
145 | /*16*/{PECHE_WITH_ACCENTS, "p\\u00E9che", "en", UCOL_SECONDARY, USEARCH_ANY_BASE_WEIGHT_IS_WILDCARD, "wordbreaker", {3, 79, 94, 107, -1}, {5, 5, 6, 5}}, | |
146 | /*17*/{PECHE_WITH_ACCENTS, "pech\\u00E9", "en", UCOL_SECONDARY, USEARCH_PATTERN_BASE_WEIGHT_IS_WILDCARD, NULL, {3, 59, 94, -1}, {5, 5, 6}}, | |
147 | /*18*/{PECHE_WITH_ACCENTS, "pech\\u00E9", "en", UCOL_SECONDARY, USEARCH_PATTERN_BASE_WEIGHT_IS_WILDCARD, "wordbreaker", {3, 59, 94, -1}, {5, 5, 6}}, | |
148 | /*19*/{PECHE_WITH_ACCENTS, "pech\\u00E9", "en", UCOL_SECONDARY, USEARCH_ANY_BASE_WEIGHT_IS_WILDCARD, NULL, {3, 13, 24, 36, 46, 59, 69, 79, 94, 107, -1}, {5, 5, 5, 5, 5, 5, 5, 5, 6, 5}}, | |
149 | /*20*/{PECHE_WITH_ACCENTS, "pech\\u00E9", "en", UCOL_SECONDARY, USEARCH_ANY_BASE_WEIGHT_IS_WILDCARD, "wordbreaker", {3, 13, 36, 59, 79, 94, 107, -1}, {5, 5, 5, 5, 5, 6, 5}}, | |
150 | /*21*/{PECHE_WITH_ACCENTS, "peche\\u0301", "en", UCOL_SECONDARY, USEARCH_PATTERN_BASE_WEIGHT_IS_WILDCARD, NULL, {3, 59, 94, -1}, {5, 5, 6}}, | |
151 | /*22*/{PECHE_WITH_ACCENTS, "peche\\u0301", "en", UCOL_SECONDARY, USEARCH_PATTERN_BASE_WEIGHT_IS_WILDCARD, "wordbreaker", {3, 59, 94, -1}, {5, 5, 6}}, | |
152 | /*23*/{PECHE_WITH_ACCENTS, "peche\\u0301", "en", UCOL_SECONDARY, USEARCH_ANY_BASE_WEIGHT_IS_WILDCARD, NULL, {3, 13, 24, 36, 46, 59, 69, 79, 94, 107, -1}, {5, 5, 5, 5, 5, 5, 5, 5, 6, 5}}, | |
153 | /*24*/{PECHE_WITH_ACCENTS, "peche\\u0301", "en", UCOL_SECONDARY, USEARCH_ANY_BASE_WEIGHT_IS_WILDCARD, "wordbreaker", {3, 13, 36, 59, 79, 94, 107, -1}, {5, 5, 5, 5, 5, 6, 5}}, | |
154 | /* more tests for modified element comparison (with fr), ticket #7093 */ | |
155 | /*25*/{PECHE_WITH_ACCENTS, "peche", "fr", UCOL_PRIMARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {3, 13, 24, 36, 46, 59, 69, 79, 94, 107, -1}, {5, 5, 5, 5, 5, 5, 5, 5, 6, 5}}, | |
156 | /*26*/{PECHE_WITH_ACCENTS, "peche", "fr", UCOL_PRIMARY, USEARCH_STANDARD_ELEMENT_COMPARISON, "wordbreaker", {3, 13, 36, 59, 79, 94, 107, -1}, {5, 5, 5, 5, 5, 6, 5}}, | |
157 | /*27*/{PECHE_WITH_ACCENTS, "peche", "fr", UCOL_SECONDARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {107, -1}, {5}}, | |
158 | /*28*/{PECHE_WITH_ACCENTS, "peche", "fr", UCOL_SECONDARY, USEARCH_PATTERN_BASE_WEIGHT_IS_WILDCARD, NULL, {3, 13, 24, 36, 46, 59, 69, 79, 94, 107, -1}, {5, 5, 5, 5, 5, 5, 5, 5, 6, 5}}, | |
159 | /*29*/{PECHE_WITH_ACCENTS, "peche", "fr", UCOL_SECONDARY, USEARCH_PATTERN_BASE_WEIGHT_IS_WILDCARD, "wordbreaker", {3, 13, 36, 59, 79, 94, 107, -1}, {5, 5, 5, 5, 5, 6, 5}}, | |
160 | /*30*/{PECHE_WITH_ACCENTS, "p\\u00E9che", "fr", UCOL_SECONDARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {24, 69, 79, -1}, {5, 5, 5}}, | |
161 | /*31*/{PECHE_WITH_ACCENTS, "p\\u00E9che", "fr", UCOL_SECONDARY, USEARCH_STANDARD_ELEMENT_COMPARISON, "wordbreaker", {79, -1}, {5}}, | |
162 | /*32*/{PECHE_WITH_ACCENTS, "p\\u00E9che", "fr", UCOL_SECONDARY, USEARCH_PATTERN_BASE_WEIGHT_IS_WILDCARD, NULL, {3, 24, 69, 79, -1}, {5, 5, 5, 5}}, | |
163 | /*33*/{PECHE_WITH_ACCENTS, "p\\u00E9che", "fr", UCOL_SECONDARY, USEARCH_PATTERN_BASE_WEIGHT_IS_WILDCARD, "wordbreaker", {3, 79, -1}, {5, 5}}, | |
164 | /*34*/{PECHE_WITH_ACCENTS, "p\\u00E9che", "fr", UCOL_SECONDARY, USEARCH_ANY_BASE_WEIGHT_IS_WILDCARD, NULL, {3, 24, 69, 79, 94, 107, -1}, {5, 5, 5, 5, 6, 5}}, | |
165 | /*35*/{PECHE_WITH_ACCENTS, "p\\u00E9che", "fr", UCOL_SECONDARY, USEARCH_ANY_BASE_WEIGHT_IS_WILDCARD, "wordbreaker", {3, 79, 94, 107, -1}, {5, 5, 6, 5}}, | |
166 | /*36*/{PECHE_WITH_ACCENTS, "pech\\u00E9", "fr", UCOL_SECONDARY, USEARCH_PATTERN_BASE_WEIGHT_IS_WILDCARD, NULL, {3, 59, 94, -1}, {5, 5, 6}}, | |
167 | /*37*/{PECHE_WITH_ACCENTS, "pech\\u00E9", "fr", UCOL_SECONDARY, USEARCH_PATTERN_BASE_WEIGHT_IS_WILDCARD, "wordbreaker", {3, 59, 94, -1}, {5, 5, 6}}, | |
168 | /*38*/{PECHE_WITH_ACCENTS, "pech\\u00E9", "fr", UCOL_SECONDARY, USEARCH_ANY_BASE_WEIGHT_IS_WILDCARD, NULL, {3, 13, 24, 36, 46, 59, 69, 79, 94, 107, -1}, {5, 5, 5, 5, 5, 5, 5, 5, 6, 5}}, | |
169 | /*39*/{PECHE_WITH_ACCENTS, "pech\\u00E9", "fr", UCOL_SECONDARY, USEARCH_ANY_BASE_WEIGHT_IS_WILDCARD, "wordbreaker", {3, 13, 36, 59, 79, 94, 107, -1}, {5, 5, 5, 5, 5, 6, 5}}, | |
170 | /*40*/{PECHE_WITH_ACCENTS, "peche\\u0301", "fr", UCOL_SECONDARY, USEARCH_PATTERN_BASE_WEIGHT_IS_WILDCARD, NULL, {3, 59, 94, -1}, {5, 5, 6}}, | |
171 | /*41*/{PECHE_WITH_ACCENTS, "peche\\u0301", "fr", UCOL_SECONDARY, USEARCH_PATTERN_BASE_WEIGHT_IS_WILDCARD, "wordbreaker", {3, 59, 94, -1}, {5, 5, 6}}, | |
172 | /*42*/{PECHE_WITH_ACCENTS, "peche\\u0301", "fr", UCOL_SECONDARY, USEARCH_ANY_BASE_WEIGHT_IS_WILDCARD, NULL, {3, 13, 24, 36, 46, 59, 69, 79, 94, 107, -1}, {5, 5, 5, 5, 5, 5, 5, 5, 6, 5}}, | |
173 | /*43*/{PECHE_WITH_ACCENTS, "peche\\u0301", "fr", UCOL_SECONDARY, USEARCH_ANY_BASE_WEIGHT_IS_WILDCARD, "wordbreaker", {3, 13, 36, 59, 79, 94, 107, -1}, {5, 5, 5, 5, 5, 6, 5}}, | |
46f4442e A |
174 | |
175 | #if 0 | |
176 | /* Ticket 5382 */ | |
729e4ab9 | 177 | {"12\\u0171", "\\u0170", NULL, UCOL_SECONDARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {2, -1}, {2}}, |
46f4442e A |
178 | #endif |
179 | ||
729e4ab9 | 180 | {NULL, NULL, NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}} |
b75a7d8f A |
181 | }; |
182 | ||
183 | static const SearchData VARIABLE[] = { | |
184 | /*012345678901234567890123456789012345678901234567890123456789*/ | |
185 | {"blackbirds black blackbirds blackbird black-bird", | |
729e4ab9 | 186 | "blackbird", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {0, 17, 28, 38, -1}, |
b75a7d8f A |
187 | {9, 9, 9, 10}}, |
188 | /* to see that it doesn't go into an infinite loop if the start of text | |
189 | is a ignorable character */ | |
729e4ab9 A |
190 | {" on", "go", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}}, |
191 | {"abcdefghijklmnopqrstuvwxyz", " ", NULL, UCOL_PRIMARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, | |
b75a7d8f A |
192 | {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, |
193 | 20, 21, 22, 23, 24, 25, -1}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
194 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, | |
195 | /* testing tightest match */ | |
729e4ab9 | 196 | {" abc a bc ab c a bc ab c", "abc", NULL, UCOL_QUATERNARY, USEARCH_STANDARD_ELEMENT_COMPARISON, |
b75a7d8f A |
197 | NULL, {1, -1}, {3}}, |
198 | /*012345678901234567890123456789012345678901234567890123456789 */ | |
729e4ab9 | 199 | {" abc a bc ab c a bc ab c", "abc", NULL, UCOL_SECONDARY, USEARCH_STANDARD_ELEMENT_COMPARISON, |
b75a7d8f A |
200 | NULL, {1, 6, 13, 21, 31, -1}, {3, 4, 4, 5, 5}}, |
201 | /* totally ignorable text */ | |
729e4ab9 | 202 | {" ---------------", "abc", NULL, UCOL_SECONDARY, USEARCH_STANDARD_ELEMENT_COMPARISON, |
b75a7d8f | 203 | NULL, {-1}, {0}}, |
729e4ab9 | 204 | {NULL, NULL, NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}} |
b75a7d8f A |
205 | }; |
206 | ||
207 | static const SearchData NORMEXACT[] = { | |
729e4ab9 | 208 | {"a\\u0300\\u0325", "a\\u0325\\u0300", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {0, -1}, {3}}, |
46f4442e A |
209 | |
210 | #if GRAPHEME_BOUNDARIES | |
729e4ab9 | 211 | {"a\\u0300\\u0325", "\\u0325\\u0300", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}}, |
46f4442e | 212 | #else |
729e4ab9 | 213 | {"a\\u0300\\u0325", "\\u0325\\u0300", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {1, -1}, {2}}, |
46f4442e A |
214 | #endif |
215 | ||
729e4ab9 | 216 | {NULL, NULL, NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}} |
b75a7d8f A |
217 | }; |
218 | ||
219 | static const SearchData NONNORMEXACT[] = { | |
729e4ab9 A |
220 | {"a\\u0300\\u0325", "\\u0325\\u0300", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}}, |
221 | {NULL, NULL, NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}} | |
b75a7d8f A |
222 | }; |
223 | ||
224 | static const SearchData OVERLAP[] = { | |
729e4ab9 | 225 | {"abababab", "abab", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {0, 2, 4, -1}, |
b75a7d8f | 226 | {4, 4, 4}}, |
729e4ab9 | 227 | {NULL, NULL, NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}} |
b75a7d8f A |
228 | }; |
229 | ||
230 | static const SearchData NONOVERLAP[] = { | |
729e4ab9 A |
231 | {"abababab", "abab", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {0, 4, -1}, {4, 4}}, |
232 | {NULL, NULL, NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}} | |
b75a7d8f A |
233 | }; |
234 | ||
235 | static const SearchData COLLATOR[] = { | |
236 | /* english */ | |
729e4ab9 | 237 | {"fox fpx", "fox", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {0, -1}, {3}}, |
b75a7d8f | 238 | /* tailored */ |
729e4ab9 A |
239 | {"fox fpx", "fox", NULL, UCOL_PRIMARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {0, 4, -1}, {3, 3}}, |
240 | {NULL, NULL, NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}} | |
b75a7d8f A |
241 | }; |
242 | ||
243 | static const SearchData PATTERN[] = { | |
244 | {"The quick brown fox jumps over the lazy foxes", "the", NULL, | |
729e4ab9 | 245 | UCOL_PRIMARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {0, 31, -1}, {3, 3}}, |
b75a7d8f | 246 | {"The quick brown fox jumps over the lazy foxes", "fox", NULL, |
729e4ab9 A |
247 | UCOL_PRIMARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {16, 40, -1}, {3, 3}}, |
248 | {NULL, NULL, NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}} | |
b75a7d8f A |
249 | }; |
250 | ||
251 | static const SearchData TEXT[] = { | |
729e4ab9 | 252 | {"the foxy brown fox", "fox", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {4, 15, -1}, |
b75a7d8f | 253 | {3, 3}}, |
729e4ab9 | 254 | {"the quick brown fox", "fox", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {16, -1}, |
b75a7d8f | 255 | {3}}, |
729e4ab9 | 256 | {NULL, NULL, NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}} |
b75a7d8f A |
257 | }; |
258 | ||
259 | static const SearchData COMPOSITEBOUNDARIES[] = { | |
46f4442e | 260 | #if GRAPHEME_BOUNDARIES |
729e4ab9 A |
261 | {"\\u00C0", "A", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}}, |
262 | {"A\\u00C0C", "A", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {0, -1}, {1}}, | |
263 | {"\\u00C0A", "A", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {1, -1}, {1}}, | |
264 | {"B\\u00C0", "A", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}}, | |
265 | {"\\u00C0B", "A", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}}, | |
266 | {"\\u00C0", "\\u0300", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}}, | |
267 | {"\\u0300\\u00C0", "\\u0300", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {0, -1}, {1}}, | |
46f4442e | 268 | #else |
729e4ab9 A |
269 | {"\\u00C0", "A", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {0, -1}, {1}}, |
270 | {"A\\u00C0C", "A", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {0, 1, -1}, {1, 1}}, | |
271 | {"\\u00C0A", "A", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {0, 1, -1}, {1, 1}}, | |
272 | {"B\\u00C0", "A", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {1, -1}, {1}}, | |
273 | {"\\u00C0B", "A", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {0, -1}, {1}}, | |
274 | {"\\u00C0", "\\u0300", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {0, -1}, {1}}, | |
275 | {"\\u0300\\u00C0", "\\u0300", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {0, 1, -1}, | |
b75a7d8f | 276 | {1, 1}}, |
46f4442e A |
277 | #endif |
278 | ||
729e4ab9 | 279 | {"\\u00C0\\u0300", "\\u0300", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}}, |
b75a7d8f | 280 | /* A + 030A + 0301 */ |
729e4ab9 A |
281 | {"\\u01FA", "\\u01FA", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {0, -1}, {1}}, |
282 | {"\\u01FA", "A\\u030A\\u0301", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {0, -1}, {1}}, | |
283 | {"\\u01FA", "\\u030A", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}}, | |
284 | {"\\u01FA", "A\\u030A", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}}, | |
285 | {"\\u01FA", "\\u030AA", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}}, | |
286 | {"\\u01FA", "\\u0301", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}}, | |
287 | {"\\u01FA", "A\\u0301", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}}, | |
288 | {"\\u01FA", "\\u0301A", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}}, | |
46f4442e A |
289 | |
290 | #if GRAPHEME_BOUNDARIES | |
729e4ab9 | 291 | {"\\u01FA", "\\u030A\\u0301", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}}, |
46f4442e | 292 | #else |
729e4ab9 | 293 | {"\\u01FA", "\\u030A\\u0301", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {0, -1}, {1}}, |
46f4442e A |
294 | #endif |
295 | ||
729e4ab9 A |
296 | {"A\\u01FA", "A\\u030A", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}}, |
297 | {"\\u01FAA", "\\u0301A", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}}, | |
298 | {"\\u0F73", "\\u0F73", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {0, -1}, {1}}, | |
299 | {"\\u0F73", "\\u0F71", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}}, | |
300 | {"\\u0F73", "\\u0F72", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}}, | |
301 | {"\\u0F73", "\\u0F71\\u0F72", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {0, -1}, {1}}, | |
302 | {"A\\u0F73", "A\\u0F71", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}}, | |
303 | {"\\u0F73A", "\\u0F72A", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}}, | |
46f4442e A |
304 | |
305 | /* Ticket 5024 */ | |
729e4ab9 | 306 | {"a\\u00e1", "a\\u00e1", NULL, UCOL_SECONDARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {0, -1}, {2}}, |
46f4442e A |
307 | |
308 | /* Ticket 5420 */ | |
729e4ab9 A |
309 | {"fu\\u00dfball", "fu\\u00df", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {0, -1}, {3}}, |
310 | {"fu\\u00dfball", "fuss", NULL, UCOL_PRIMARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {0, -1}, {3}}, | |
311 | {"fu\\u00dfball", "uss", NULL, UCOL_PRIMARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {1, -1}, {2}}, | |
46f4442e | 312 | |
729e4ab9 | 313 | {NULL, NULL, NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}} |
b75a7d8f A |
314 | }; |
315 | ||
316 | static const SearchData MATCH[] = { | |
729e4ab9 | 317 | {"a busy bee is a very busy beeee", "bee", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, |
b75a7d8f A |
318 | {7, 26, -1}, {3, 3}}, |
319 | /* 012345678901234567890123456789012345678901234567890 */ | |
320 | {"a busy bee is a very busy beeee with no bee life", "bee", NULL, | |
729e4ab9 A |
321 | UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {7, 26, 40, -1}, {3, 3, 3}}, |
322 | {NULL, NULL, NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}} | |
b75a7d8f A |
323 | }; |
324 | ||
325 | static const SearchData SUPPLEMENTARY[] = { | |
326 | /* 012345678901234567890123456789012345678901234567890012345678901234567890123456789012345678901234567890012345678901234567890123456789 */ | |
327 | {"abc \\uD800\\uDC00 \\uD800\\uDC01 \\uD801\\uDC00 \\uD800\\uDC00abc abc\\uD800\\uDC00 \\uD800\\uD800\\uDC00 \\uD800\\uDC00\\uDC00", | |
729e4ab9 | 328 | "\\uD800\\uDC00", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {4, 13, 22, 26, 29, -1}, |
b75a7d8f | 329 | {2, 2, 2, 2, 2}}, |
374ca955 | 330 | {"and\\uD834\\uDDB9this sentence", "\\uD834\\uDDB9", NULL, |
729e4ab9 | 331 | UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {3, -1}, {2}}, |
374ca955 | 332 | {"and \\uD834\\uDDB9 this sentence", " \\uD834\\uDDB9 ", NULL, |
729e4ab9 | 333 | UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {3, -1}, {4}}, |
374ca955 | 334 | {"and-\\uD834\\uDDB9-this sentence", "-\\uD834\\uDDB9-", NULL, |
729e4ab9 | 335 | UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {3, -1}, {4}}, |
374ca955 | 336 | {"and,\\uD834\\uDDB9,this sentence", ",\\uD834\\uDDB9,", NULL, |
729e4ab9 | 337 | UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {3, -1}, {4}}, |
374ca955 | 338 | {"and?\\uD834\\uDDB9?this sentence", "?\\uD834\\uDDB9?", NULL, |
729e4ab9 A |
339 | UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {3, -1}, {4}}, |
340 | {NULL, NULL, NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}} | |
b75a7d8f A |
341 | }; |
342 | ||
343 | static const char *CONTRACTIONRULE = | |
344 | "&z = ab/c < AB < X\\u0300 < ABC < X\\u0300\\u0315"; | |
345 | ||
346 | static const SearchData CONTRACTION[] = { | |
347 | /* common discontiguous */ | |
729e4ab9 | 348 | {"A\\u0300\\u0315", "\\u0300", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}}, |
46f4442e A |
349 | |
350 | #if GRAPHEME_BOUNDARIES | |
729e4ab9 | 351 | {"A\\u0300\\u0315", "\\u0300\\u0315", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}}, |
46f4442e | 352 | #else |
729e4ab9 | 353 | {"A\\u0300\\u0315", "\\u0300\\u0315", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {1, -1}, {2}}, |
46f4442e A |
354 | #endif |
355 | ||
b75a7d8f | 356 | /* contraction prefix */ |
729e4ab9 | 357 | {"AB\\u0315C", "A", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}}, |
46f4442e A |
358 | |
359 | #if GRAPHEME_BOUNDARIES | |
729e4ab9 A |
360 | {"AB\\u0315C", "AB", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}}, |
361 | {"AB\\u0315C", "\\u0315", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}}, | |
46f4442e | 362 | #else |
729e4ab9 A |
363 | {"AB\\u0315C", "AB", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {0, -1}, {2}}, |
364 | {"AB\\u0315C", "\\u0315", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {2, -1}, {1}}, | |
46f4442e A |
365 | #endif |
366 | ||
b75a7d8f A |
367 | /* discontiguous problem here for backwards iteration. |
368 | accents not found because discontiguous stores all information */ | |
729e4ab9 | 369 | {"X\\u0300\\u0319\\u0315", "\\u0319", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, |
b75a7d8f A |
370 | {0}}, |
371 | /* ends not with a contraction character */ | |
729e4ab9 | 372 | {"X\\u0315\\u0300D", "\\u0300\\u0315", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, |
b75a7d8f | 373 | {0}}, |
729e4ab9 | 374 | {"X\\u0315\\u0300D", "X\\u0300\\u0315", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, |
b75a7d8f | 375 | {0, -1}, {3}}, |
729e4ab9 | 376 | {"X\\u0300\\u031A\\u0315D", "X\\u0300", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, |
b75a7d8f A |
377 | {0}}, |
378 | /* blocked discontiguous */ | |
729e4ab9 | 379 | {"X\\u0300\\u031A\\u0315D", "\\u031A\\u0315D", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, |
b75a7d8f | 380 | {-1}, {0}}, |
46f4442e A |
381 | |
382 | #if GRAPHEME_BOUNDARIES | |
383 | /* | |
384 | * "ab" generates a contraction that's an expansion. The "z" matches the | |
385 | * first CE of the expansion but the match fails because it ends in the | |
386 | * middle of an expansion... | |
387 | */ | |
729e4ab9 | 388 | {"ab", "z", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}}, |
46f4442e | 389 | #else |
729e4ab9 | 390 | {"ab", "z", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {0, -1}, {2}}, |
46f4442e A |
391 | #endif |
392 | ||
729e4ab9 | 393 | {NULL, NULL, NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}} |
b75a7d8f A |
394 | }; |
395 | ||
396 | static const char *IGNORABLERULE = "&a = \\u0300"; | |
397 | ||
398 | static const SearchData IGNORABLE[] = { | |
46f4442e A |
399 | #if GRAPHEME_BOUNDARIES |
400 | /* | |
401 | * This isn't much of a test when matches have to be on | |
402 | * grapheme boundiaries. The match at 0 only works because | |
403 | * it's at the start of the text. | |
404 | */ | |
729e4ab9 | 405 | {"\\u0300\\u0315 \\u0300\\u0315 ", "\\u0300", NULL, UCOL_PRIMARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, |
46f4442e A |
406 | {0, -1}, {2}}, |
407 | #else | |
729e4ab9 | 408 | {"\\u0300\\u0315 \\u0300\\u0315 ", "\\u0300", NULL, UCOL_PRIMARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, |
46f4442e A |
409 | {0, 3, -1}, {2, 2}}, |
410 | #endif | |
411 | ||
729e4ab9 | 412 | {NULL, NULL, NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}} |
b75a7d8f A |
413 | }; |
414 | ||
415 | static const SearchData BASICCANONICAL[] = { | |
729e4ab9 A |
416 | {"xxxxxxxxxxxxxxxxxxxx", "fisher", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}}, |
417 | {"silly spring string", "string", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {13, -1}, | |
b75a7d8f | 418 | {6}}, |
729e4ab9 | 419 | {"silly spring string string", "string", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, |
b75a7d8f | 420 | {13, 20, -1}, {6, 6}}, |
729e4ab9 | 421 | {"silly string spring string", "string", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, |
b75a7d8f | 422 | {6, 20, -1}, {6, 6}}, |
729e4ab9 | 423 | {"string spring string", "string", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {0, 14, -1}, |
b75a7d8f | 424 | {6, 6}}, |
729e4ab9 A |
425 | {"Scott Ganyo", "c", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {1, -1}, {1}}, |
426 | {"Scott Ganyo", " ", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {5, -1}, {1}}, | |
46f4442e A |
427 | |
428 | #if GRAPHEME_BOUNDARIES | |
729e4ab9 A |
429 | {"\\u0300\\u0325", "\\u0300", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}}, |
430 | {"a\\u0300\\u0325", "\\u0300", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}}, | |
431 | {"a\\u0300\\u0325", "\\u0300\\u0325", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}}, | |
432 | {"a\\u0300b", "\\u0300", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}}, | |
433 | {"a\\u0300\\u0325b", "\\u0300b", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}}, | |
434 | {"\\u0325\\u0300A\\u0325\\u0300", "\\u0300A\\u0300", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, | |
46f4442e | 435 | NULL, {-1}, {0}}, |
729e4ab9 | 436 | {"\\u0325\\u0300A\\u0325\\u0300", "\\u0325A\\u0325", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, |
46f4442e A |
437 | NULL, {-1}, {0}}, |
438 | {"a\\u0300\\u0325b\\u0300\\u0325c \\u0325b\\u0300 \\u0300b\\u0325", | |
729e4ab9 | 439 | "\\u0300b\\u0325", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}}, |
46f4442e | 440 | #else |
729e4ab9 A |
441 | {"\\u0300\\u0325", "\\u0300", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {0, -1}, {2}}, |
442 | {"a\\u0300\\u0325", "\\u0300", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {1, -1}, {2}}, | |
443 | {"a\\u0300\\u0325", "\\u0300\\u0325", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {1, -1}, | |
b75a7d8f | 444 | {2}}, |
729e4ab9 A |
445 | {"a\\u0300b", "\\u0300", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {1, -1}, {1}}, |
446 | {"a\\u0300\\u0325b", "\\u0300b", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {1, -1}, {3}}, | |
447 | {"\\u0325\\u0300A\\u0325\\u0300", "\\u0300A\\u0300", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, | |
b75a7d8f | 448 | NULL, {0, -1}, {5}}, |
729e4ab9 | 449 | {"\\u0325\\u0300A\\u0325\\u0300", "\\u0325A\\u0325", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, |
b75a7d8f A |
450 | NULL, {0, -1}, {5}}, |
451 | {"a\\u0300\\u0325b\\u0300\\u0325c \\u0325b\\u0300 \\u0300b\\u0325", | |
729e4ab9 | 452 | "\\u0300b\\u0325", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {1, 12, -1}, {5, 3}}, |
46f4442e A |
453 | #endif |
454 | ||
729e4ab9 A |
455 | {"\\u00c4\\u0323", "A\\u0323\\u0308", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {0, -1}, {2}}, |
456 | {"\\u0308\\u0323", "\\u0323\\u0308", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {0, -1}, {2}}, | |
457 | {NULL, NULL, NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}} | |
b75a7d8f A |
458 | }; |
459 | ||
46f4442e | 460 | |
b75a7d8f | 461 | static const SearchData NORMCANONICAL[] = { |
46f4442e A |
462 | #if GRAPHEME_BOUNDARIES |
463 | /* | |
464 | * These tests don't really mean anything. With matches restricted to grapheme | |
465 | * boundaries, isCanonicalMatch doesn't mean anything unless normalization is | |
466 | * also turned on... | |
467 | */ | |
729e4ab9 A |
468 | {"\\u0300\\u0325", "\\u0300", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}}, |
469 | {"\\u0300\\u0325", "\\u0325", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}}, | |
470 | {"a\\u0300\\u0325", "\\u0325\\u0300", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}}, | |
471 | {"a\\u0300\\u0325", "\\u0300\\u0325", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}}, | |
472 | {"a\\u0300\\u0325", "\\u0325", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}}, | |
473 | {"a\\u0300\\u0325", "\\u0300", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}}, | |
46f4442e | 474 | #else |
729e4ab9 A |
475 | {"\\u0300\\u0325", "\\u0300", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {0, -1}, {2}}, |
476 | {"\\u0300\\u0325", "\\u0325", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {0, -1}, {2}}, | |
477 | {"a\\u0300\\u0325", "\\u0325\\u0300", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {1, -1}, | |
b75a7d8f | 478 | {2}}, |
729e4ab9 | 479 | {"a\\u0300\\u0325", "\\u0300\\u0325", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {1, -1}, |
b75a7d8f | 480 | {2}}, |
729e4ab9 A |
481 | {"a\\u0300\\u0325", "\\u0325", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {1, -1}, {2}}, |
482 | {"a\\u0300\\u0325", "\\u0300", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {1, -1}, {2}}, | |
46f4442e A |
483 | #endif |
484 | ||
729e4ab9 | 485 | {NULL, NULL, NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}} |
b75a7d8f A |
486 | }; |
487 | ||
488 | static const SearchData BREAKITERATORCANONICAL[] = { | |
729e4ab9 | 489 | {"foxy fox", "fox", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, "characterbreaker", {0, 5, -1}, |
b75a7d8f | 490 | {3, 3}}, |
729e4ab9 A |
491 | {"foxy fox", "fox", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, "wordbreaker", {5, -1}, {3}}, |
492 | {"This is a toe T\\u00F6ne", "toe", "de", UCOL_PRIMARY, USEARCH_STANDARD_ELEMENT_COMPARISON, | |
b75a7d8f | 493 | "characterbreaker", {10, 14, -1}, {3, 2}}, |
729e4ab9 | 494 | {"This is a toe T\\u00F6ne", "toe", "de", UCOL_PRIMARY, USEARCH_STANDARD_ELEMENT_COMPARISON, "wordbreaker", |
b75a7d8f A |
495 | {10, -1}, {3}}, |
496 | {"Channel, another channel, more channels, and one last Channel", | |
729e4ab9 | 497 | "Channel", "es", UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, "wordbreaker", {0, 54, -1}, {7, 7}}, |
b75a7d8f | 498 | /* jitterbug 1745 */ |
729e4ab9 | 499 | {"testing that \\u00e9 does not match e", "e", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, |
b75a7d8f A |
500 | "characterbreaker", {1, 17, 30, -1}, {1, 1, 1}}, |
501 | {"testing that string ab\\u00e9cd does not match e", "e", NULL, | |
729e4ab9 A |
502 | UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, "characterbreaker", {1, 28, 41, -1}, {1, 1, 1}}, |
503 | {"\\u00c9", "e", "fr", UCOL_PRIMARY, USEARCH_STANDARD_ELEMENT_COMPARISON, "characterbreaker", {0, -1}, {1}}, | |
504 | {NULL, NULL, NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}} | |
b75a7d8f A |
505 | }; |
506 | ||
507 | static const SearchData STRENGTHCANONICAL[] = { | |
508 | /*012345678901234567890123456789012345678901234567890123456789 */ | |
509 | {"The quick brown fox jumps over the lazy foxes", "fox", "en", | |
729e4ab9 | 510 | UCOL_PRIMARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {16, 40, -1}, {3, 3}}, |
b75a7d8f | 511 | {"The quick brown fox jumps over the lazy foxes", "fox", "en", |
729e4ab9 | 512 | UCOL_PRIMARY, USEARCH_STANDARD_ELEMENT_COMPARISON, "wordbreaker", {16, -1}, {3}}, |
b75a7d8f | 513 | {"blackbirds Pat p\\u00E9ch\\u00E9 p\\u00EAche p\\u00E9cher p\\u00EAcher Tod T\\u00F6ne black Tofu blackbirds Ton PAT toehold blackbird black-bird pat toe big Toe", |
729e4ab9 A |
514 | "peche", "fr", UCOL_PRIMARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {15, 21, 27, 34, -1}, {5, 5, 5, 5}}, |
515 | {"This is a toe T\\u00F6ne", "toe", "de", UCOL_PRIMARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, | |
b75a7d8f A |
516 | {10, 14, -1}, {3, 2}}, |
517 | {"A channel, another CHANNEL, more Channels, and one last channel...", | |
729e4ab9 | 518 | "channel", "es", UCOL_PRIMARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {2, 19, 33, 56, -1}, |
b75a7d8f | 519 | {7, 7, 7, 7}}, |
729e4ab9 | 520 | {NULL, NULL, NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}} |
b75a7d8f A |
521 | }; |
522 | ||
523 | static const SearchData VARIABLECANONICAL[] = { | |
524 | /*012345678901234567890123456789012345678901234567890123456789 */ | |
525 | {"blackbirds black blackbirds blackbird black-bird", | |
729e4ab9 | 526 | "blackbird", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {0, 17, 28, 38, -1}, |
b75a7d8f A |
527 | {9, 9, 9, 10}}, |
528 | /* to see that it doesn't go into an infinite loop if the start of text | |
529 | is a ignorable character */ | |
729e4ab9 A |
530 | {" on", "go", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}}, |
531 | {"abcdefghijklmnopqrstuvwxyz", " ", NULL, UCOL_PRIMARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, | |
b75a7d8f A |
532 | {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, |
533 | 20, 21, 22, 23, 24, 25, -1}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
534 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, | |
535 | /* testing tightest match */ | |
729e4ab9 | 536 | {" abc a bc ab c a bc ab c", "abc", NULL, UCOL_QUATERNARY, USEARCH_STANDARD_ELEMENT_COMPARISON, |
b75a7d8f A |
537 | NULL, {1, -1}, {3}}, |
538 | /*012345678901234567890123456789012345678901234567890123456789 */ | |
729e4ab9 | 539 | {" abc a bc ab c a bc ab c", "abc", NULL, UCOL_SECONDARY, USEARCH_STANDARD_ELEMENT_COMPARISON, |
b75a7d8f A |
540 | NULL, {1, 6, 13, 21, 31, -1}, {3, 4, 4, 5, 5}}, |
541 | /* totally ignorable text */ | |
729e4ab9 | 542 | {" ---------------", "abc", NULL, UCOL_SECONDARY, USEARCH_STANDARD_ELEMENT_COMPARISON, |
b75a7d8f | 543 | NULL, {-1}, {0}}, |
729e4ab9 | 544 | {NULL, NULL, NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}} |
b75a7d8f A |
545 | }; |
546 | ||
547 | static const SearchData OVERLAPCANONICAL[] = { | |
729e4ab9 | 548 | {"abababab", "abab", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {0, 2, 4, -1}, |
b75a7d8f | 549 | {4, 4, 4}}, |
729e4ab9 | 550 | {NULL, NULL, NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}} |
b75a7d8f A |
551 | }; |
552 | ||
553 | static const SearchData NONOVERLAPCANONICAL[] = { | |
729e4ab9 A |
554 | {"abababab", "abab", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {0, 4, -1}, {4, 4}}, |
555 | {NULL, NULL, NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}} | |
b75a7d8f A |
556 | }; |
557 | ||
558 | static const SearchData COLLATORCANONICAL[] = { | |
559 | /* english */ | |
729e4ab9 | 560 | {"fox fpx", "fox", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {0, -1}, {3}}, |
b75a7d8f | 561 | /* tailored */ |
729e4ab9 A |
562 | {"fox fpx", "fox", NULL, UCOL_PRIMARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {0, 4, -1}, {3, 3}}, |
563 | {NULL, NULL, NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}} | |
b75a7d8f A |
564 | }; |
565 | ||
566 | static const SearchData PATTERNCANONICAL[] = { | |
567 | {"The quick brown fox jumps over the lazy foxes", "the", NULL, | |
729e4ab9 | 568 | UCOL_PRIMARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {0, 31, -1}, {3, 3}}, |
b75a7d8f | 569 | {"The quick brown fox jumps over the lazy foxes", "fox", NULL, |
729e4ab9 A |
570 | UCOL_PRIMARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {16, 40, -1}, {3, 3}}, |
571 | {NULL, NULL, NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}} | |
b75a7d8f A |
572 | }; |
573 | ||
574 | static const SearchData TEXTCANONICAL[] = { | |
729e4ab9 | 575 | {"the foxy brown fox", "fox", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {4, 15, -1}, |
b75a7d8f | 576 | {3, 3}}, |
729e4ab9 | 577 | {"the quick brown fox", "fox", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {16, -1}, |
b75a7d8f | 578 | {3}}, |
729e4ab9 | 579 | {NULL, NULL, NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}} |
b75a7d8f A |
580 | }; |
581 | ||
582 | static const SearchData COMPOSITEBOUNDARIESCANONICAL[] = { | |
46f4442e | 583 | #if GRAPHEME_BOUNDARIES |
729e4ab9 A |
584 | {"\\u00C0", "A", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}}, |
585 | {"A\\u00C0C", "A", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {0, -1}, {1}}, | |
586 | {"\\u00C0A", "A", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {1, -1}, {1}}, | |
587 | {"B\\u00C0", "A", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}}, | |
588 | {"\\u00C0B", "A", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}}, | |
589 | {"\\u00C0", "\\u0300", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}}, | |
46f4442e A |
590 | |
591 | /* first one matches only because it's at the start of the text */ | |
729e4ab9 | 592 | {"\\u0300\\u00C0", "\\u0300", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {0, -1}, {1}}, |
46f4442e A |
593 | |
594 | /* \\u0300 blocked by \\u0300 */ | |
729e4ab9 | 595 | {"\\u00C0\\u0300", "\\u0300", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}}, |
46f4442e | 596 | #else |
729e4ab9 A |
597 | {"\\u00C0", "A", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {0, -1}, {1}}, |
598 | {"A\\u00C0C", "A", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {0, 1, -1}, {1, 1}}, | |
599 | {"\\u00C0A", "A", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {0, 1, -1}, {1, 1}}, | |
600 | {"B\\u00C0", "A", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {1, -1}, {1}}, | |
601 | {"\\u00C0B", "A", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {0, -1}, {1}}, | |
602 | {"\\u00C0", "\\u0300", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {0, -1}, {1}}, | |
603 | {"\\u0300\\u00C0", "\\u0300", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {0, 1, -1}, | |
b75a7d8f A |
604 | {1, 1}}, |
605 | /* \\u0300 blocked by \\u0300 */ | |
729e4ab9 | 606 | {"\\u00C0\\u0300", "\\u0300", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {0, -1}, {2}}, |
46f4442e A |
607 | #endif |
608 | ||
b75a7d8f | 609 | /* A + 030A + 0301 */ |
729e4ab9 A |
610 | {"\\u01FA", "\\u01FA", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {0, -1}, {1}}, |
611 | {"\\u01FA", "A\\u030A\\u0301", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {0, -1}, {1}}, | |
46f4442e A |
612 | |
613 | #if GRAPHEME_BOUNDARIES | |
729e4ab9 A |
614 | {"\\u01FA", "\\u030A", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}}, |
615 | {"\\u01FA", "A\\u030A", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}}, | |
46f4442e | 616 | #else |
729e4ab9 A |
617 | {"\\u01FA", "\\u030A", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {0, -1}, {1}}, |
618 | {"\\u01FA", "A\\u030A", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {0, -1}, {1}}, | |
46f4442e A |
619 | #endif |
620 | ||
729e4ab9 | 621 | {"\\u01FA", "\\u030AA", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}}, |
46f4442e A |
622 | |
623 | #if GRAPHEME_BOUNDARIES | |
729e4ab9 | 624 | {"\\u01FA", "\\u0301", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}}, |
46f4442e | 625 | #else |
729e4ab9 | 626 | {"\\u01FA", "\\u0301", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {0, -1}, {1}}, |
46f4442e A |
627 | #endif |
628 | ||
b75a7d8f | 629 | /* blocked accent */ |
729e4ab9 A |
630 | {"\\u01FA", "A\\u0301", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}}, |
631 | {"\\u01FA", "\\u0301A", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}}, | |
46f4442e A |
632 | |
633 | #if GRAPHEME_BOUNDARIES | |
729e4ab9 A |
634 | {"\\u01FA", "\\u030A\\u0301", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}}, |
635 | {"A\\u01FA", "A\\u030A", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}}, | |
636 | {"\\u01FAA", "\\u0301A", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}}, | |
46f4442e | 637 | #else |
729e4ab9 A |
638 | {"\\u01FA", "\\u030A\\u0301", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {0, -1}, {1}}, |
639 | {"A\\u01FA", "A\\u030A", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {1, -1}, {1}}, | |
640 | {"\\u01FAA", "\\u0301A", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {0, -1}, {2}}, | |
46f4442e A |
641 | #endif |
642 | ||
729e4ab9 | 643 | {"\\u0F73", "\\u0F73", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {0, -1}, {1}}, |
46f4442e A |
644 | |
645 | #if GRAPHEME_BOUNDARIES | |
729e4ab9 A |
646 | {"\\u0F73", "\\u0F71", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}}, |
647 | {"\\u0F73", "\\u0F72", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}}, | |
46f4442e | 648 | #else |
729e4ab9 A |
649 | {"\\u0F73", "\\u0F71", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {0, -1}, {1}}, |
650 | {"\\u0F73", "\\u0F72", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {0, -1}, {1}}, | |
46f4442e A |
651 | #endif |
652 | ||
729e4ab9 | 653 | {"\\u0F73", "\\u0F71\\u0F72", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {0, -1}, {1}}, |
46f4442e A |
654 | |
655 | #if GRAPHEME_BOUNDARIES | |
729e4ab9 A |
656 | {"A\\u0F73", "A\\u0F71", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}}, |
657 | {"\\u0F73A", "\\u0F72A", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}}, | |
46f4442e | 658 | {"\\u01FA A\\u0301\\u030A A\\u030A\\u0301 A\\u030A \\u01FA", "A\\u030A", |
729e4ab9 | 659 | NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {10, -1}, {2}}, |
46f4442e | 660 | #else |
729e4ab9 A |
661 | {"A\\u0F73", "A\\u0F71", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {0, -1}, {2}}, |
662 | {"\\u0F73A", "\\u0F72A", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {0, -1}, {2}}, | |
b75a7d8f | 663 | {"\\u01FA A\\u0301\\u030A A\\u030A\\u0301 A\\u030A \\u01FA", "A\\u030A", |
729e4ab9 | 664 | NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {0, 6, 10, 13, -1}, {1, 3, 2, 1}}, |
46f4442e A |
665 | #endif |
666 | ||
729e4ab9 | 667 | {NULL, NULL, NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}} |
b75a7d8f A |
668 | }; |
669 | ||
670 | static const SearchData MATCHCANONICAL[] = { | |
729e4ab9 | 671 | {"a busy bee is a very busy beeee", "bee", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, |
b75a7d8f A |
672 | {7, 26, -1}, {3, 3}}, |
673 | /*012345678901234567890123456789012345678901234567890 */ | |
674 | {"a busy bee is a very busy beeee with no bee life", "bee", NULL, | |
729e4ab9 A |
675 | UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {7, 26, 40, -1}, {3, 3, 3}}, |
676 | {NULL, NULL, NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}} | |
b75a7d8f A |
677 | }; |
678 | ||
679 | static const SearchData SUPPLEMENTARYCANONICAL[] = { | |
680 | /*012345678901234567890123456789012345678901234567890012345678901234567890123456789012345678901234567890012345678901234567890123456789 */ | |
681 | {"abc \\uD800\\uDC00 \\uD800\\uDC01 \\uD801\\uDC00 \\uD800\\uDC00abc abc\\uD800\\uDC00 \\uD800\\uD800\\uDC00 \\uD800\\uDC00\\uDC00", | |
729e4ab9 | 682 | "\\uD800\\uDC00", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {4, 13, 22, 26, 29, -1}, |
b75a7d8f | 683 | {2, 2, 2, 2, 2}}, |
374ca955 | 684 | {"and\\uD834\\uDDB9this sentence", "\\uD834\\uDDB9", NULL, |
729e4ab9 | 685 | UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {3, -1}, {2}}, |
374ca955 | 686 | {"and \\uD834\\uDDB9 this sentence", " \\uD834\\uDDB9 ", NULL, |
729e4ab9 | 687 | UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {3, -1}, {4}}, |
374ca955 | 688 | {"and-\\uD834\\uDDB9-this sentence", "-\\uD834\\uDDB9-", NULL, |
729e4ab9 | 689 | UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {3, -1}, {4}}, |
374ca955 | 690 | {"and,\\uD834\\uDDB9,this sentence", ",\\uD834\\uDDB9,", NULL, |
729e4ab9 | 691 | UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {3, -1}, {4}}, |
374ca955 | 692 | {"and?\\uD834\\uDDB9?this sentence", "?\\uD834\\uDDB9?", NULL, |
729e4ab9 A |
693 | UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {3, -1}, {4}}, |
694 | {NULL, NULL, NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}} | |
b75a7d8f A |
695 | }; |
696 | ||
697 | static const SearchData CONTRACTIONCANONICAL[] = { | |
698 | /* common discontiguous */ | |
46f4442e | 699 | #if GRAPHEME_BOUNDARIES |
729e4ab9 A |
700 | {"A\\u0300\\u0315", "\\u0300", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}}, |
701 | {"A\\u0300\\u0315", "\\u0300\\u0315", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}}, | |
46f4442e | 702 | #else |
729e4ab9 A |
703 | {"A\\u0300\\u0315", "\\u0300", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {1, -1}, {2}}, |
704 | {"A\\u0300\\u0315", "\\u0300\\u0315", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {1, -1}, {2}}, | |
46f4442e A |
705 | #endif |
706 | ||
b75a7d8f | 707 | /* contraction prefix */ |
729e4ab9 | 708 | {"AB\\u0315C", "A", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}}, |
46f4442e A |
709 | |
710 | #if GRAPHEME_BOUNDARIES | |
729e4ab9 A |
711 | {"AB\\u0315C", "AB", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}}, |
712 | {"AB\\u0315C", "\\u0315", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}}, | |
46f4442e | 713 | #else |
729e4ab9 A |
714 | {"AB\\u0315C", "AB", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {0, -1}, {2}}, |
715 | {"AB\\u0315C", "\\u0315", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {2, -1}, {1}}, | |
46f4442e A |
716 | #endif |
717 | ||
b75a7d8f A |
718 | /* discontiguous problem here for backwards iteration. |
719 | forwards gives 0, 4 but backwards give 1, 3 */ | |
729e4ab9 | 720 | /* {"X\\u0300\\u0319\\u0315", "\\u0319", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {0, -1}, |
b75a7d8f A |
721 | {4}}, */ |
722 | ||
723 | /* ends not with a contraction character */ | |
729e4ab9 A |
724 | {"X\\u0315\\u0300D", "\\u0300\\u0315", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}}, |
725 | {"X\\u0315\\u0300D", "X\\u0300\\u0315", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {0, -1}, {3}}, | |
46f4442e A |
726 | |
727 | #if GRAPHEME_BOUNDARIES | |
729e4ab9 | 728 | {"X\\u0300\\u031A\\u0315D", "X\\u0300", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}}, |
46f4442e | 729 | |
b75a7d8f | 730 | /* blocked discontiguous */ |
729e4ab9 | 731 | {"X\\u0300\\u031A\\u0315D", "\\u031A\\u0315D", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}}, |
46f4442e A |
732 | |
733 | /* | |
734 | * "ab" generates a contraction that's an expansion. The "z" matches the | |
735 | * first CE of the expansion but the match fails because it ends in the | |
736 | * middle of an expansion... | |
737 | */ | |
729e4ab9 | 738 | {"ab", "z", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {2}}, |
46f4442e | 739 | #else |
729e4ab9 | 740 | {"X\\u0300\\u031A\\u0315D", "X\\u0300", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {0, -1}, {4}}, |
46f4442e A |
741 | |
742 | /* blocked discontiguous */ | |
729e4ab9 | 743 | {"X\\u0300\\u031A\\u0315D", "\\u031A\\u0315D", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {1, -1}, {4}}, |
46f4442e | 744 | |
729e4ab9 | 745 | {"ab", "z", NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {0, -1}, {2}}, |
46f4442e A |
746 | #endif |
747 | ||
729e4ab9 | 748 | {NULL, NULL, NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}} |
b75a7d8f A |
749 | }; |
750 | ||
46f4442e | 751 | static const SearchData DIACRITICMATCH[] = { |
4388f060 A |
752 | {"\\u03BA\\u03B1\\u03B9\\u0300\\u0020\\u03BA\\u03B1\\u1F76", "\\u03BA\\u03B1\\u03B9", NULL, UCOL_PRIMARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {0, 5,-1}, {4, 3}}, |
753 | {"\\u0061\\u0061\\u00E1", "\\u0061\\u00E1", NULL, UCOL_SECONDARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {1, -1}, {2}}, | |
754 | {"\\u0020\\u00C2\\u0303\\u0020\\u0041\\u0061\\u1EAA\\u0041\\u0302\\u0303\\u00C2\\u0303\\u1EAB\\u0061\\u0302\\u0303\\u00E2\\u0303\\uD806\\uDC01\\u0300\\u0020", | |
755 | "\\u00C2\\u0303", "LDE_AN_CX_EX_FX_HX_NX_S1", UCOL_PRIMARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {1, 4, 5, 6, 7, 10, 12, 13, 16,-1}, {2, 1, 1, 1, 3, 2, 1, 3, 2}}, | |
756 | {NULL, NULL, NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}} | |
46f4442e A |
757 | }; |
758 | ||
2ca993e8 | 759 | static const SearchData INDICPREFIXMATCH[] = { |
b331163b | 760 | {"\\u0915\\u0020\\u0915\\u0901\\u0020\\u0915\\u0902\\u0020\\u0915\\u0903\\u0020\\u0915\\u0940\\u0020\\u0915\\u093F\\u0020\\u0915\\u0943\\u0020\\u0915\\u093C\\u0020\\u0958", |
2ca993e8 | 761 | "\\u0915", NULL, UCOL_PRIMARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {0, 2, 5, 8, 11, 14, 17, 20, 23,-1}, {1, 2, 2, 2, 1, 1, 1, 2, 1}}, |
b331163b | 762 | {"\\u0915\\u0924\\u0020\\u0915\\u0924\\u0940\\u0020\\u0915\\u0924\\u093F\\u0020\\u0915\\u0924\\u0947\\u0020\\u0915\\u0943\\u0924\\u0020\\u0915\\u0943\\u0924\\u0947", |
2ca993e8 | 763 | "\\u0915\\u0924", NULL, UCOL_PRIMARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {0, 3, 7, 11, -1}, {2, 2, 2, 2}}, |
b331163b | 764 | {"\\u0915\\u0924\\u0020\\u0915\\u0924\\u0940\\u0020\\u0915\\u0924\\u093F\\u0020\\u0915\\u0924\\u0947\\u0020\\u0915\\u0943\\u0924\\u0020\\u0915\\u0943\\u0924\\u0947", |
2ca993e8 | 765 | "\\u0915\\u0943\\u0924", NULL, UCOL_PRIMARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {15, 19, -1}, {3, 3}}, |
b331163b A |
766 | {NULL, NULL, NULL, UCOL_TERTIARY, USEARCH_STANDARD_ELEMENT_COMPARISON, NULL, {-1}, {0}} |
767 | }; | |
768 | ||
b75a7d8f A |
769 | #endif /* #if !UCONFIG_NO_COLLATION */ |
770 | ||
771 | #endif |