diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index c06856c60af..9abb29b8001 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 ---------------------- 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 a2e8285ee97..6e76deb94e0 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 getSchemaFlags() { + return flags; + } + public NamedList getTopTerms() { return topTerms; } 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 4f3f83d00fa..0f91adfe162 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 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