()
| 305 | } |
| 306 | |
| 307 | @Test |
| 308 | @SuppressWarnings({"unchecked"}) |
| 309 | public void testRandomJoin() throws Exception { |
| 310 | int indexIter = 50 * RANDOM_MULTIPLIER; |
| 311 | int queryIter = 50 * RANDOM_MULTIPLIER; |
| 312 | |
| 313 | // groups of fields that have any chance of matching... used to |
| 314 | // increase test effectiveness by avoiding 0 resultsets much of the time. |
| 315 | String[][] compat = |
| 316 | new String[][] { |
| 317 | {"small_s", "small2_s", "small2_ss", "small3_ss"}, |
| 318 | {"small_i", "small2_i", "small2_is", "small3_is", "small_i_dv", "small_is_dv"} |
| 319 | }; |
| 320 | |
| 321 | while (--indexIter >= 0) { |
| 322 | int indexSize = random().nextInt(20 * RANDOM_MULTIPLIER); |
| 323 | |
| 324 | List<FldType> types = new ArrayList<>(); |
| 325 | types.add(new FldType("id", ONE_ONE, new SVal('A', 'Z', 4, 4))); |
| 326 | types.add(new FldType("score_f", ONE_ONE, new FVal(1, 100))); // field used to score |
| 327 | types.add( |
| 328 | new FldType("small_s", ZERO_ONE, new SVal('a', (char) ('c' + indexSize / 3), 1, 1))); |
| 329 | types.add( |
| 330 | new FldType("small2_s", ZERO_ONE, new SVal('a', (char) ('c' + indexSize / 3), 1, 1))); |
| 331 | types.add( |
| 332 | new FldType("small2_ss", ZERO_TWO, new SVal('a', (char) ('c' + indexSize / 3), 1, 1))); |
| 333 | types.add(new FldType("small3_ss", new IRange(0, 25), new SVal('A', 'z', 1, 1))); |
| 334 | types.add(new FldType("small_i", ZERO_ONE, new IRange(0, 5 + indexSize / 3))); |
| 335 | types.add(new FldType("small2_i", ZERO_ONE, new IRange(0, 5 + indexSize / 3))); |
| 336 | types.add(new FldType("small2_is", ZERO_TWO, new IRange(0, 5 + indexSize / 3))); |
| 337 | types.add(new FldType("small3_is", new IRange(0, 25), new IRange(0, 100))); |
| 338 | types.add(new FldType("small_i_dv", ZERO_ONE, new IRange(0, 5 + indexSize / 3))); |
| 339 | types.add(new FldType("small_is_dv", ZERO_ONE, new IRange(0, 5 + indexSize / 3))); |
| 340 | |
| 341 | clearIndex(); |
| 342 | @SuppressWarnings({"rawtypes"}) |
| 343 | Map<Comparable, Doc> model = indexDocs(types, null, indexSize); |
| 344 | @SuppressWarnings({"rawtypes"}) |
| 345 | Map<String, Map<Comparable, Set<Comparable>>> pivots = new HashMap<>(); |
| 346 | |
| 347 | for (int qiter = 0; qiter < queryIter; qiter++) { |
| 348 | String fromField; |
| 349 | String toField; |
| 350 | /* disable matching incompatible fields since 7.0... it doesn't work with point fields and doesn't really make sense? |
| 351 | if (random().nextInt(100) < 5) { |
| 352 | // pick random fields 5% of the time |
| 353 | fromField = types.get(random().nextInt(types.size())).fname; |
| 354 | // pick the same field 50% of the time we pick a random field (since other fields won't match anything) |
| 355 | toField = (random().nextInt(100) < 50) ? fromField : types.get(random().nextInt(types.size())).fname; |
| 356 | } else |
| 357 | */ |
| 358 | { |
| 359 | // otherwise, pick compatible fields that have a chance of matching indexed tokens |
| 360 | String[] group = compat[random().nextInt(compat.length)]; |
| 361 | fromField = group[random().nextInt(group.length)]; |
| 362 | toField = group[random().nextInt(group.length)]; |
| 363 | } |
| 364 |
nothing calls this directly
no test coverage detected