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.DateFieldGenerator
meta:datetime
, seeMetaSchema.DateTimeFieldGenerator
meta:file
, seeMetaSchema.FileFieldGenerator
meta:geopoint
, seeMetaSchema.GeoPointFieldGenerator
meta:id
, seeMetaSchema.IdFieldGenerator
meta: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
MetaType
specific generation of fields usingMetaSchema.AbstractMetaTypeFieldGenerator
All custom generators instances must be injected.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
MetaTypeFieldGenerator generates Lucene fields when encountering an object of the specified type.static class
NamedFieldGenerator generates Lucene fields when ecnountering a field with the specified name.static class
private static class
private static class
private static class
static interface
private static class
private static class
private static final class
private static class
private static class
private static final record
private static class
private static final class
private static class
private static class
private static final class
private static class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final String
private static final String
private static final Map
<String, org.apache.lucene.queryparser.flexible.standard.config.PointsConfig> private static final String
private final com.networknt.schema.JsonSchema
private final Map
<String, MetaSchema.FieldGenerator> private final Map
<String, MetaSchema.AbstractMetaTypeFieldGenerator> private final Map
<String, MetaSchema.AbstractSchemaFieldGenerator> private static final MetaSchema.FieldGenerator
private static final String
private static final String
private static final org.slf4j.Logger
private static final String
private static final String
private static final String
private static final String
private static final String
private static final Set
<MetaSchema.AbstractSchemaFieldGenerator> private static final String
private final com.networknt.schema.JsonSchemaFactory
private static final String
private static final String
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate void
appendFieldsRecursive
(org.apache.lucene.document.Document document, String metaId, @Nullable String name, com.fasterxml.jackson.databind.JsonNode node, Set<String> sortableFields) void
appendLogDataFields
(org.apache.lucene.document.Document document, MetaLog meta) void
appendObjectValueFields
(org.apache.lucene.document.Document document, MetaObject meta, Set<String> sortableFields) private com.networknt.schema.JsonSchemaFactory
com.networknt.schema.JsonSchema
getFieldTypeRecursive
(com.fasterxml.jackson.databind.JsonNode field) com.networknt.schema.JsonSchema
getSchema
(com.fasterxml.jackson.databind.JsonNode schema) com.networknt.schema.JsonSchema
private static void
indexFieldsRecursive
(Consumer<MetaSchema.IndexableField> consumer, com.fasterxml.jackson.databind.JsonNode node, @Nullable Consumer<MetaSchema.IndexableField> rootConsumer) void
indexMetaType
(MetaType type) private void
indexSchema
(com.fasterxml.jackson.databind.JsonNode schema) static String
private void
registerGenerators
(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
-