@@ -216,10 +216,9 @@ public void testSimpleTermVectors() throws IOException {
216216
217217 public void testRandomSingleTermVectors () throws IOException {
218218 FieldType ft = new FieldType ();
219- int config = randomInt (6 );
219+ int config = randomInt (4 );
220220 boolean storePositions = false ;
221221 boolean storeOffsets = false ;
222- boolean storePayloads = false ;
223222 boolean storeTermVectors = false ;
224223 switch (config ) {
225224 case 0 : {
@@ -246,23 +245,11 @@ public void testRandomSingleTermVectors() throws IOException {
246245 storeOffsets = true ;
247246 break ;
248247 }
249- case 5 : {
250- storeTermVectors = true ;
251- storePositions = true ;
252- storePayloads = true ;
253- break ;
254- }
255- case 6 : {
256- storeTermVectors = true ;
257- storePositions = true ;
258- storeOffsets = true ;
259- storePayloads = true ;
260- break ;
261- }
248+ default :
249+ throw new IllegalArgumentException ("Unsupported option: " + config );
262250 }
263251 ft .setStoreTermVectors (storeTermVectors );
264252 ft .setStoreTermVectorOffsets (storeOffsets );
265- ft .setStoreTermVectorPayloads (storePayloads );
266253 ft .setStoreTermVectorPositions (storePositions );
267254
268255 String optionString = FieldMapper .termVectorOptionsToString (ft );
@@ -293,13 +280,12 @@ public void testRandomSingleTermVectors() throws IOException {
293280 int [][] startOffset = {{10 }, {40 }, {16 }, {20 }, {35 }, {26 }, {4 }, {0 , 31 }};
294281 int [][] endOffset = {{15 }, {43 }, {19 }, {25 }, {39 }, {30 }, {9 }, {3 , 34 }};
295282
296- boolean isPayloadRequested = randomBoolean ();
297283 boolean isOffsetRequested = randomBoolean ();
298284 boolean isPositionsRequested = randomBoolean ();
299- String infoString = createInfoString (isPositionsRequested , isOffsetRequested , isPayloadRequested , optionString );
285+ String infoString = createInfoString (isPositionsRequested , isOffsetRequested , optionString );
300286 for (int i = 0 ; i < 10 ; i ++) {
301287 TermVectorsRequestBuilder resp = client ().prepareTermVectors ("test" , "type1" , Integer .toString (i ))
302- .setPayloads ( isPayloadRequested ). setOffsets (isOffsetRequested ).setPositions (isPositionsRequested ).setSelectedFields ();
288+ .setOffsets (isOffsetRequested ).setPositions (isPositionsRequested ).setSelectedFields ();
303289 TermVectorsResponse response = resp .execute ().actionGet ();
304290 assertThat (infoString + "doc id: " + i + " doesn't exists but should" , response .isExists (), equalTo (true ));
305291 Fields fields = response .getFields ();
@@ -340,13 +326,8 @@ public void testRandomSingleTermVectors() throws IOException {
340326 } else {
341327 assertThat (infoString + "positions for term: " , nextPosition , equalTo (-1 ));
342328 }
343- // only return something useful if requested and stored
344- if (isPayloadRequested && storePayloads ) {
345- assertThat (infoString + "payloads for term: " + string , docsAndPositions .getPayload (), equalTo (new BytesRef (
346- "word" )));
347- } else {
348- assertThat (infoString + "payloads for term: " + string , docsAndPositions .getPayload (), equalTo (null ));
349- }
329+ // payloads are never made by the mapping in this test
330+ assertNull (infoString + "payloads for term: " + string , docsAndPositions .getPayload ());
350331 // only return something useful if requested and stored
351332 if (isOffsetRequested && storeOffsets ) {
352333
@@ -365,11 +346,9 @@ public void testRandomSingleTermVectors() throws IOException {
365346 }
366347 }
367348
368- private String createInfoString (boolean isPositionsRequested , boolean isOffsetRequested , boolean isPayloadRequested ,
369- String optionString ) {
349+ private String createInfoString (boolean isPositionsRequested , boolean isOffsetRequested , String optionString ) {
370350 String ret = "Store config: " + optionString + "\n " + "Requested: pos-"
371- + (isPositionsRequested ? "yes" : "no" ) + ", offsets-" + (isOffsetRequested ? "yes" : "no" ) + ", payload- "
372- + (isPayloadRequested ? "yes" : "no" ) + "\n " ;
351+ + (isPositionsRequested ? "yes" : "no" ) + ", offsets-" + (isOffsetRequested ? "yes" : "no" ) + "\n " ;
373352 return ret ;
374353 }
375354
0 commit comments