lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gerlowsk...@apache.org
Subject lucene-solr:master: SOLR-12947: Misc JsonQueryRequest code cleanup
Date Fri, 09 Nov 2018 19:53:19 GMT
Repository: lucene-solr
Updated Branches:
  refs/heads/master 77a4bfaa9 -> 4410ef941


SOLR-12947: Misc JsonQueryRequest code cleanup


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/4410ef94
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/4410ef94
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/4410ef94

Branch: refs/heads/master
Commit: 4410ef941acf02e752a599b5403091f86e66a9a2
Parents: 77a4bfa
Author: Jason Gerlowski <gerlowskija@apache.org>
Authored: Fri Nov 9 13:15:08 2018 -0500
Committer: Jason Gerlowski <gerlowskija@apache.org>
Committed: Fri Nov 9 13:15:08 2018 -0500

----------------------------------------------------------------------
 .../client/solrj/request/json/JsonQueryRequest.java    | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/4410ef94/solr/solrj/src/java/org/apache/solr/client/solrj/request/json/JsonQueryRequest.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/request/json/JsonQueryRequest.java
b/solr/solrj/src/java/org/apache/solr/client/solrj/request/json/JsonQueryRequest.java
index bc79881..781d9c3 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/request/json/JsonQueryRequest.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/request/json/JsonQueryRequest.java
@@ -191,9 +191,7 @@ public class JsonQueryRequest extends QueryRequest {
     if (filterQuery == null) {
       throw new IllegalArgumentException("'filterQuery' must be non-null");
     }
-    jsonRequestMap.putIfAbsent("filter", new ArrayList<Object>());
-    final List<Object> filters = (List<Object>) jsonRequestMap.get("filter");
-    filters.add(filterQuery);
+    ((List)jsonRequestMap.computeIfAbsent("filter", s -> new ArrayList<>())).add(filterQuery)
;
     return this;
   }
 
@@ -220,9 +218,7 @@ public class JsonQueryRequest extends QueryRequest {
     if (filterQuery == null) {
       throw new IllegalArgumentException("'filterQuery' parameter must be non-null");
     }
-    jsonRequestMap.putIfAbsent("filter", new ArrayList<Object>());
-    final List<Object> filters = (List<Object>) jsonRequestMap.get("filter");
-    filters.add(filterQuery);
+    ((List)jsonRequestMap.computeIfAbsent("filter", s -> new ArrayList<>())).add(filterQuery)
;
     return this;
   }
 
@@ -254,6 +250,7 @@ public class JsonQueryRequest extends QueryRequest {
     if (fieldNames == null) {
       throw new IllegalArgumentException("'fieldNames' parameter must be non-null");
     }
+
     jsonRequestMap.putIfAbsent("fields", new ArrayList<String>());
     final List<String> fields = (List<String>) jsonRequestMap.get("fields");
     for (String fieldName : fieldNames) {
@@ -286,9 +283,7 @@ public class JsonQueryRequest extends QueryRequest {
       throw new IllegalArgumentException("'value' parameter must be non-null");
     }
 
-    jsonRequestMap.putIfAbsent("params", new HashMap<String, Object>());
-    final Map<String, Object> miscParamsMap = (Map<String, Object>) jsonRequestMap.get("params");
-    miscParamsMap.put(name, value);
+    ((Map<String, Object>)jsonRequestMap.computeIfAbsent("params", s -> new HashMap<String,
Object>())).put(name, value);
     return this;
   }
 


Mime
View raw message