Package ch.rswk.meta.engine
Class MetaSchema
java.lang.Object
ch.rswk.meta.engine.MetaSchema
MetaSchema handles generating Lucene
Document fields from JSON schemas. Defines built in meta schema types and the mechanism
for using them in JSON schemas with JsonSchemaFactory. Provides map of PointsConfig in pointsConfig() for
searching numeric Lucene fields.
Built in schema types available for MetaType and MetaAction schemas:
meta:date, seeMetaSchema.DateFieldGeneratormeta:datetime, seeMetaSchema.DateTimeFieldGeneratormeta:file, seeMetaSchema.FileFieldGeneratormeta:geopoint, seeMetaSchema.GeoPointFieldGeneratormeta:id, seeMetaSchema.IdFieldGeneratormeta:uuid, seeMetaSchema.UuidFieldGenerator
In addition to the built in types, generation of Lucene fields can be customized in a number of ways:
- Schemas can define their own reusable types using definitions
- Application wide custom schema types can be defined using
MetaSchema.AbstractSchemaFieldGenerator - Field name specific generation using
MetaSchema.AbstractNamedFieldGenerator MetaTypespecific generation of fields usingMetaSchema.AbstractMetaTypeFieldGenerator
All custom generators instances must be injected.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classMetaTypeFieldGenerator generates Lucene fields when encountering an object of the specified type.static classNamedFieldGenerator generates Lucene fields when ecnountering a field with the specified name.static classprivate static classprivate static classprivate static classstatic interfaceprivate static classprivate static classprivate static final classprivate static classprivate static classprivate static final recordprivate static classprivate static final classprivate static classprivate static classprivate static final classprivate static class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Stringprivate static final Stringprivate static final Map<String, org.apache.lucene.queryparser.flexible.standard.config.PointsConfig> private static final Stringprivate final com.networknt.schema.JsonSchemaprivate final Map<String, MetaSchema.FieldGenerator> private final Map<String, MetaSchema.AbstractMetaTypeFieldGenerator> private final Map<String, MetaSchema.AbstractSchemaFieldGenerator> private static final MetaSchema.FieldGeneratorprivate static final Stringprivate static final Stringprivate static final org.slf4j.Loggerprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Set<MetaSchema.AbstractSchemaFieldGenerator> private static final Stringprivate final com.networknt.schema.JsonSchemaFactoryprivate static final Stringprivate static final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidappendFieldsRecursive(org.apache.lucene.document.Document document, String metaId, @Nullable String name, com.fasterxml.jackson.databind.JsonNode node, Set<String> sortableFields) voidappendLogDataFields(org.apache.lucene.document.Document document, MetaLog meta) voidappendObjectValueFields(org.apache.lucene.document.Document document, MetaObject meta, Set<String> sortableFields) private com.networknt.schema.JsonSchemaFactorycom.networknt.schema.JsonSchemagetFieldTypeRecursive(com.fasterxml.jackson.databind.JsonNode field) com.networknt.schema.JsonSchemagetSchema(com.fasterxml.jackson.databind.JsonNode schema) com.networknt.schema.JsonSchemaprivate static voidindexFieldsRecursive(Consumer<MetaSchema.IndexableField> consumer, com.fasterxml.jackson.databind.JsonNode node, @Nullable Consumer<MetaSchema.IndexableField> rootConsumer) voidindexMetaType(MetaType type) private voidindexSchema(com.fasterxml.jackson.databind.JsonNode schema) static Stringprivate voidregisterGenerators(Set<MetaSchema.FieldGenerator> generators)
-
Field Details
-
LOG
private static final org.slf4j.Logger LOG -
ANY_OF_VALUE
-
ARRAY_TYPE
-
DEFAULT_ANALYZERS
-
DEFAULT_POINT_CONFIGS
-
DEFINITIONS_REF_PREFIX
-
ILLEGAL_FIELD_GENERATOR
-
ILLEGAL_FIELD_NAMES
-
ITEMS_VALUE
-
JSON_DRAFT_SCHEMA_URI
-
META_URI_SCHEME
- See Also:
-
OBJECT_TYPE
-
ONE_OF_VALUE
-
PROPERTIES_VALUE
-
REF_VALUE
-
SCHEMA_GENERATORS
-
SCHEMA_ID_FORMAT
- See Also:
-
SIMPLE_SCHEMA_FORMAT
- See Also:
-
TYPE_VALUE
-
analyzers
-
draftSchema
private final com.networknt.schema.JsonSchema draftSchema -
generatorsByFieldName
-
generatorsByMetaTypeId
-
generatorsByTypeRef
-
pointConfigs
-
schemaFactory
private final com.networknt.schema.JsonSchemaFactory schemaFactory
-
-
Constructor Details
-
MetaSchema
-
-
Method Details
-
analyzers
-
appendFieldsRecursive
-
appendLogDataFields
-
appendObjectValueFields
public void appendObjectValueFields(org.apache.lucene.document.Document document, MetaObject meta, Set<String> sortableFields) -
buildJsonSchemaFactory
private com.networknt.schema.JsonSchemaFactory buildJsonSchemaFactory() -
draftSchema
public com.networknt.schema.JsonSchema draftSchema() -
getFieldTypeRecursive
-
getSchema
-
getSchema
public com.networknt.schema.JsonSchema getSchema(com.fasterxml.jackson.databind.JsonNode schema) -
indexFieldsRecursive
private static void indexFieldsRecursive(Consumer<MetaSchema.IndexableField> consumer, com.fasterxml.jackson.databind.JsonNode node, @Nullable Consumer<MetaSchema.IndexableField> rootConsumer) -
indexMetaType
-
indexSchema
private void indexSchema(com.fasterxml.jackson.databind.JsonNode schema) -
newSchema
-
pointsConfig
-
registerGenerators
-