Github user justinleet commented on a diff in the pull request:

    https://github.com/apache/metron/pull/1050#discussion_r193207415
  
    --- Diff: 
metron-platform/metron-solr/src/main/java/org/apache/metron/solr/dao/SolrRetrieveLatestDao.java
 ---
    @@ -61,10 +70,13 @@ public Document getLatest(String guid, String 
collection) throws IOException {
       public Iterable<Document> getAllLatest(List<GetRequest> getRequests) 
throws IOException {
         Map<String, Collection<String>> collectionIdMap = new HashMap<>();
         for (GetRequest getRequest : getRequests) {
    -      Collection<String> ids = collectionIdMap
    -          .getOrDefault(getRequest.getSensorType(), new HashSet<>());
    -      ids.add(getRequest.getGuid());
    -      collectionIdMap.put(getRequest.getSensorType(), ids);
    +      Optional<String> index = SolrUtilities
    +          .getIndex(config.getIndexSupplier(), getRequest.getSensorType(), 
Optional.empty());
    +      if (index.isPresent()) {
    +        Collection<String> ids = collectionIdMap.getOrDefault(index.get(), 
new HashSet<>());
    +        ids.add(getRequest.getGuid());
    +        collectionIdMap.put(index.get(), ids);
    +      }
    --- End diff --
    
    It means that someone requested something bogus (e.g. a GUID against the 
wrong sensor).  Logging it is a good idea, though.


---

Reply via email to