@@ -107,7 +107,7 @@ public void testC_QueryPojos() throws Exception {
107107
108108
109109 PojoQueryBuilder <City > qb = cities .getQueryBuilder ();
110- QueryDefinition query = qb .word ("Tungi" , "Dalatando" , "Chittagong" );
110+ QueryDefinition query = qb .term ("Tungi" , "Dalatando" , "Chittagong" );
111111 page = cities .search (query , 1 );
112112 iterator = page .iterator ();
113113 numRead = 0 ;
@@ -130,7 +130,7 @@ public void testC_QueryPojos() throws Exception {
130130 assertEquals ("Failed to find number of records expected" , 7 , numRead );
131131 assertEquals ("PojoPage failed to report number of records expected" , numRead , page .size ());
132132
133- query = qb .containerQuery ("alternateNames" , qb .word ("San" , "Santo" ));
133+ query = qb .containerQuery ("alternateNames" , qb .term ("San" , "Santo" ));
134134 page = cities .search (query , 1 );
135135 iterator = page .iterator ();
136136 numRead = 0 ;
@@ -143,6 +143,17 @@ public void testC_QueryPojos() throws Exception {
143143 assertEquals ("Failed to find number of records expected" , 11 , numRead );
144144 assertEquals ("PojoPage failed to report number of records expected" , numRead , page .size ());
145145
146+ query = qb .range ("population" , Operator .LT , 350000 );
147+ page = cities .search (query , 1 );
148+ iterator = page .iterator ();
149+ numRead = 0 ;
150+ while ( iterator .hasNext () ) {
151+ City city = iterator .next ();
152+ numRead ++;
153+ }
154+ assertEquals ("Failed to find number of records expected" , 21 , numRead );
155+ assertEquals ("PojoPage failed to report number of records expected" , numRead , page .size ());
156+
146157 query = qb .geospatial (
147158 qb .geoField ("latLong" ),
148159 qb .circle (-34 , -58 , 1 )
@@ -190,17 +201,6 @@ public void testC_QueryPojos() throws Exception {
190201 // when this works we'll find out how many we expect
191202 assertEquals ("Failed to find number of records expected" , -1 , numRead );
192203 assertEquals ("PojoPage failed to report number of records expected" , numRead , page .size ());
193-
194- query = qb .range ("population" , Operator .LT , 350000 );
195- page = cities .search (query , 1 );
196- iterator = page .iterator ();
197- numRead = 0 ;
198- while ( iterator .hasNext () ) {
199- City city = iterator .next ();
200- numRead ++;
201- }
202- assertEquals ("Failed to find number of records expected" , 21 , numRead );
203- assertEquals ("PojoPage failed to report number of records expected" , numRead , page .size ());
204204 }
205205
206206 @ Test
@@ -241,17 +241,16 @@ public void testD_PojosWithChildren() throws Exception {
241241 query = countriesQb .range ("continent" , Operator .EQ , "AS" );
242242 assertEquals ("Should find two cities" , 2 , cities .search (query , 1 ).getTotalSize ());
243243
244- // the following currently don't work even in the cts:search layer
245- // all countries containing the term "SA"
246- query = countriesQb .word ("SA" );
244+ // all countries containing the term SA
245+ query = countriesQb .containerQuery (countriesQb .term ("SA" ));
247246 assertEquals ("Should find one city" , 1 , cities .search (query , 1 ).getTotalSize ());
248247
249- // all cities containing the term "SA"
250- query = qb .word ( "SA" );
251- assertEquals ("Should find two cities" , 2 , cities .search (query , 1 ).getTotalSize ());
248+ // all cities containing the term SA
249+ query = qb .containerQuery ( qb . term ( "SA" ) );
250+ assertEquals ("Should find two cities" , 61 , cities .search (query , 1 ).getTotalSize ());
252251
253252 // all countries containing the field "currencyName" with the term "peso"
254- query = countriesQb .word ("currencyName" , new String []{ "peso" } );
253+ query = countriesQb .word ("currencyName" , "peso" );
255254 assertEquals ("Should find one city" , 1 , cities .search (query , 1 ).getTotalSize ());
256255 }
257256
0 commit comments