metron-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From merrimanr <...@git.apache.org>
Subject [GitHub] metron pull request #677: METRON-1073: Add option to limit fields returned f...
Date Wed, 23 Aug 2017 20:21:52 GMT
Github user merrimanr commented on a diff in the pull request:

    https://github.com/apache/metron/pull/677#discussion_r134860066
  
    --- Diff: metron-platform/metron-elasticsearch/src/main/java/org/apache/metron/elasticsearch/dao/ElasticsearchDao.java
---
    @@ -100,7 +107,16 @@ public SearchResponse search(SearchRequest searchRequest) throws
InvalidSearchEx
         searchResponse.setResults(Arrays.stream(elasticsearchResponse.getHits().getHits()).map(searchHit
-> {
           SearchResult searchResult = new SearchResult();
           searchResult.setId(searchHit.getId());
    -      searchResult.setSource(searchHit.getSource());
    +      Map<String, Object> source;
    +      if (fields.isPresent()) {
    +        source = new HashMap<>();
    +        searchHit.getFields().forEach((key, value) -> {
    +          source.put(key, value.getValues().size() == 1 ? value.getValue() : value.getValues());
    --- End diff --
    
    If there are no results this line doesn't even get called because this code is inside
a Stream map function that's iterating over the results.  The test case is really simple though
so I added it just to be sure.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message