MCPcopy Create free account
hub / github.com/apache/solr / createJoinMap

Method createJoinMap

solr/core/src/test/org/apache/solr/TestJoin.java:433–457  ·  view source on GitHub ↗
(
      Map<Comparable, Doc> model, String fromField, String toField)

Source from the content-addressed store, hash-verified

431 }
432
433 @SuppressWarnings({"rawtypes"})
434 Map<Comparable, Set<Comparable>> createJoinMap(
435 Map<Comparable, Doc> model, String fromField, String toField) {
436 Map<Comparable, Set<Comparable>> id_to_id = new HashMap<>();
437
438 Map<Comparable, List<Comparable>> value_to_id = invertField(model, toField);
439
440 for (Comparable fromId : model.keySet()) {
441 Doc doc = model.get(fromId);
442 List<Comparable> vals = doc.getValues(fromField);
443 if (vals == null) continue;
444 for (Comparable val : vals) {
445 List<Comparable> toIds = value_to_id.get(val);
446 if (toIds == null) continue;
447 Set<Comparable> ids = id_to_id.get(fromId);
448 if (ids == null) {
449 ids = new HashSet<>();
450 id_to_id.put(fromId, ids);
451 }
452 for (Comparable toId : toIds) ids.add(toId);
453 }
454 }
455
456 return id_to_id;
457 }
458
459 @SuppressWarnings({"rawtypes"})
460 Set<Comparable> join(Collection<Doc> input, Map<Comparable, Set<Comparable>> joinMap) {

Callers 1

testRandomJoinMethod · 0.95

Calls 6

getValuesMethod · 0.95
invertFieldMethod · 0.80
getMethod · 0.65
putMethod · 0.65
addMethod · 0.65
keySetMethod · 0.45

Tested by

no test coverage detected