mirror of https://github.com/apache/lucene.git
SOLR-8985: Added back support for 'includeDynamic' flag to /schema/fields endpoint
This commit is contained in:
parent
a0bc1e6427
commit
9313a6304b
|
@ -164,6 +164,8 @@ Other Changes
|
|||
* SOLR-8967: In SolrCloud mode, under the 'Core Selector' dropdown in the UI the Replication tab won't be displayed
|
||||
anymore. The Replication tab is only beneficial to users running Solr in master-slave mode. (Varun Thacker)
|
||||
|
||||
* SOLR-8985: Added back support for 'includeDynamic' flag to /schema/fields endpoint (noble)
|
||||
|
||||
================== 6.0.0 ==================
|
||||
|
||||
Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release
|
||||
|
|
|
@ -1385,16 +1385,23 @@ public class IndexSchema {
|
|||
for (String fieldName : fieldNames) {
|
||||
fieldProperties.add(fields.get(fieldName).getNamedPropertyValues(params.getBool("showDefaults", false)));
|
||||
}
|
||||
if (params.getBool("includeDynamic", false)) {
|
||||
fieldProperties.addAll(getDynamicFields(params));
|
||||
}
|
||||
topLevel.add(FIELDS, fieldProperties);
|
||||
topLevel.add(DYNAMIC_FIELDS, getDynamicFields(params));
|
||||
topLevel.add(COPY_FIELDS, getCopyFieldProperties(false, null, null));
|
||||
return topLevel;
|
||||
}
|
||||
|
||||
private List<SimpleOrderedMap<Object>> getDynamicFields(SolrParams params) {
|
||||
List<SimpleOrderedMap<Object>> dynamicFieldProperties = new ArrayList<>();
|
||||
for (IndexSchema.DynamicField dynamicField : dynamicFields) {
|
||||
for (DynamicField dynamicField : dynamicFields) {
|
||||
if ( ! dynamicField.getRegex().startsWith(INTERNAL_POLY_FIELD_PREFIX)) { // omit internal polyfields
|
||||
dynamicFieldProperties.add(dynamicField.getPrototype().getNamedPropertyValues(params.getBool("showDefaults", false)));
|
||||
}
|
||||
}
|
||||
topLevel.add(DYNAMIC_FIELDS, dynamicFieldProperties);
|
||||
topLevel.add(COPY_FIELDS, getCopyFieldProperties(false, null, null));
|
||||
return topLevel;
|
||||
return dynamicFieldProperties;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -15,11 +15,9 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
package org.apache.solr.rest.schema;
|
||||
import com.carrotsearch.randomizedtesting.annotations.Seed;
|
||||
import org.apache.solr.rest.SolrRestletTestBase;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class TestFieldCollectionResource extends SolrRestletTestBase {
|
||||
@Test
|
||||
|
@ -39,4 +37,20 @@ public class TestFieldCollectionResource extends SolrRestletTestBase {
|
|||
"/fields/[2]/name=='_version_'");
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testJsonGetAllFieldsIncludeDynamic() throws Exception {
|
||||
assertJQ("/schema/fields?indent=on&includeDynamic=true",
|
||||
"/fields/[0]/name=='HTMLstandardtok'",
|
||||
"/fields/[1]/name=='HTMLwhitetok'",
|
||||
"/fields/[2]/name=='_version_'",
|
||||
"/fields/[98]/name=='*_d'",
|
||||
"/fields/[97]/name=='*_f'",
|
||||
"/fields/[96]/name=='*_b'",
|
||||
"/fields/[95]/name=='*_t'",
|
||||
"/fields/[94]/name=='*_l'"
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue