[ 
https://issues.apache.org/jira/browse/METRON-1585?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16502415#comment-16502415
 ] 

ASF GitHub Bot commented on METRON-1585:
----------------------------------------

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

    https://github.com/apache/metron/pull/1050#discussion_r193201422
  
    --- Diff: 
metron-platform/metron-solr/src/main/java/org/apache/metron/solr/dao/SolrRetrieveLatestDao.java
 ---
    @@ -38,16 +40,23 @@
     public class SolrRetrieveLatestDao implements RetrieveLatestDao {
     
       private transient SolrClient client;
    +  private AccessConfig config;
     
    -  public SolrRetrieveLatestDao(SolrClient client) {
    +  public SolrRetrieveLatestDao(SolrClient client, AccessConfig config) {
         this.client = client;
    +    this.config = config;
       }
     
       @Override
    -  public Document getLatest(String guid, String collection) throws 
IOException {
    -
    +  public Document getLatest(String guid, String sensorType) throws 
IOException {
         try {
    -      SolrDocument solrDocument = client.getById(collection, guid);
    +      Optional<String> index = SolrUtilities
    +          .getIndex(config.getIndexSupplier(), sensorType, 
Optional.empty());
    +      if (!index.isPresent()) {
    +        return null;
    --- End diff --
    
    Should we log if we are not able to map a sensor to its index?  That should 
not happen if everything is working as intended, right?


> SolrRetrieveLatestDao does not use the collection lookup
> --------------------------------------------------------
>
>                 Key: METRON-1585
>                 URL: https://issues.apache.org/jira/browse/METRON-1585
>             Project: Metron
>          Issue Type: Sub-task
>            Reporter: Justin Leet
>            Assignee: Justin Leet
>            Priority: Major
>
> `getLatest` interface has the second arg as "sensorType", but the Solr DAO 
> makes the assumption that it's "collection" and renames the arg and uses it 
> without retrieving the actual collection. 
> https://github.com/apache/metron/blob/feature/METRON-1416-upgrade-solr/metron-platform/metron-solr/src/main/java/org/apache/metron/solr/dao/SolrRetrieveLatestDao.java#L47
> `getAllLatest` at 
> https://github.com/apache/metron/blob/feature/METRON-1416-upgrade-solr/metron-platform/metron-solr/src/main/java/org/apache/metron/solr/dao/SolrRetrieveLatestDao.java#L47
> This can affect other DAOs that defer to this DAO (e.g. update and metaalert)



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to