lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From romseyg...@apache.org
Subject [2/2] lucene-solr:branch_6x: SOLR-9205: Parse schema in LukeResponse
Date Fri, 30 Sep 2016 09:59:26 GMT
SOLR-9205: Parse schema in LukeResponse


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

Branch: refs/heads/branch_6x
Commit: 45e2e25233e8a83aaacfb696c2576cd2bf2eb28f
Parents: 1f0d75b
Author: Alan Woodward <romseygeek@apache.org>
Authored: Fri Sep 30 10:49:14 2016 +0100
Committer: Alan Woodward <romseygeek@apache.org>
Committed: Fri Sep 30 10:59:06 2016 +0100

----------------------------------------------------------------------
 solr/CHANGES.txt                                |  3 ++
 .../client/solrj/response/LukeResponse.java     | 15 +++++++--
 .../solr/client/solrj/SolrExampleTests.java     | 32 +++++++++++---------
 3 files changed, 32 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/45e2e252/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index c06856c..9abb29b 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -73,6 +73,9 @@ New Features
 
 * SOLR-9258: Optimizing, storing and deploying AI models with Streaming Expressions (Cao
Manh Dat, Joel Bernstein)
 
+* SOLR-9205: Added method LukeResponse.getSchemaFlags() which returns field
+  information as an EnumSet (Fengtan, Alan Woodward)
+
 
 Bug Fixes
 ----------------------

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/45e2e252/solr/solrj/src/java/org/apache/solr/client/solrj/response/LukeResponse.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/response/LukeResponse.java b/solr/solrj/src/java/org/apache/solr/client/solrj/response/LukeResponse.java
index a2e8285..6e76deb 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/response/LukeResponse.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/response/LukeResponse.java
@@ -16,12 +16,17 @@
  */
 package org.apache.solr.client.solrj.response;
 
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.EnumSet;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
 import org.apache.solr.common.luke.FieldFlag;
 import org.apache.solr.common.util.NamedList;
 
-import java.io.Serializable;
-import java.util.*;
-
 
 /**
  * This is an incomplete representation of the data returned from Luke
@@ -178,6 +183,10 @@ public class LukeResponse extends SolrResponseBase {
       return schema;
     }
 
+    public EnumSet<FieldFlag> getSchemaFlags() {
+      return flags;
+    }
+
     public NamedList<Integer> getTopTerms() {
       return topTerms;
     }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/45e2e252/solr/solrj/src/test/org/apache/solr/client/solrj/SolrExampleTests.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/SolrExampleTests.java b/solr/solrj/src/test/org/apache/solr/client/solrj/SolrExampleTests.java
index 4f3f83d..0f91adf 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/SolrExampleTests.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/SolrExampleTests.java
@@ -17,10 +17,19 @@
 package org.apache.solr.client.solrj;
 
 
-import com.google.common.collect.Maps;
+import java.io.IOException;
+import java.lang.invoke.MethodHandles;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Random;
 
+import com.google.common.collect.Maps;
 import junit.framework.Assert;
-
 import org.apache.lucene.util.TestUtil;
 import org.apache.solr.SolrTestCaseJ4.SuppressSSL;
 import org.apache.solr.client.solrj.embedded.EmbeddedSolrServer;
@@ -41,12 +50,13 @@ import org.apache.solr.client.solrj.response.LukeResponse;
 import org.apache.solr.client.solrj.response.PivotField;
 import org.apache.solr.client.solrj.response.QueryResponse;
 import org.apache.solr.client.solrj.response.RangeFacet;
-import org.apache.solr.client.solrj.response.UpdateResponse;
 import org.apache.solr.client.solrj.response.RangeFacet.Count;
+import org.apache.solr.client.solrj.response.UpdateResponse;
 import org.apache.solr.common.SolrDocument;
 import org.apache.solr.common.SolrDocumentList;
 import org.apache.solr.common.SolrException;
 import org.apache.solr.common.SolrInputDocument;
+import org.apache.solr.common.luke.FieldFlag;
 import org.apache.solr.common.params.AnalysisParams;
 import org.apache.solr.common.params.CommonParams;
 import org.apache.solr.common.params.FacetParams;
@@ -57,17 +67,6 @@ import org.noggit.JSONParser;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.io.IOException;
-import java.lang.invoke.MethodHandles;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-import java.util.Random;
-
 import static org.junit.internal.matchers.StringContains.containsString;
 
 /**
@@ -698,7 +697,10 @@ abstract public class SolrExampleTests extends SolrExampleTestsBase
     
     luke.setShowSchema( true );
     rsp = luke.process( client );
-    assertNotNull( rsp.getFieldTypeInfo() ); 
+    assertNotNull( rsp.getFieldTypeInfo() );
+    assertNotNull(rsp.getFieldInfo().get("id").getSchemaFlags());
+    assertTrue(rsp.getFieldInfo().get("id").getSchemaFlags().contains(FieldFlag.INDEXED));
+
   }
 
  @Test


Mime
View raw message