SOLR-9205: Parse schema in LukeResponse

This commit is contained in:
Alan Woodward 2016-09-30 10:49:14 +01:00
parent ef747c8445
commit f13b727213
3 changed files with 32 additions and 18 deletions

View File

@ -108,6 +108,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
----------------------

View File

@ -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;
}

View File

@ -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