diff options
author | Tim Barron <tjbarron@google.com> | 2023-05-11 06:22:44 +0000 |
---|---|---|
committer | Tim Barron <tjbarron@google.com> | 2023-05-11 15:45:06 +0000 |
commit | fc9e6aac9c62d4546cb25548e1bbb317b7a4fd9a (patch) | |
tree | 061f4d194144ae4d5f81e6b56c148ddb5495e694 /icing/util/document-validator.cc | |
parent | a7d57e98ea7168d66cf01ace85598e33d5e9e5db (diff) | |
download | icing-fc9e6aac9c62d4546cb25548e1bbb317b7a4fd9a.tar.gz |
Update Icing from upstream.
Descriptions:
========================================================================
Modify the definition of propertyDefined:
========================================================================
Remove default args in SchemaStore::SetSchema and fix calls
========================================================================
Add allow_circular_schema_definitions flag
========================================================================
Onboard version detection to Icing
========================================================================
Add version util to help read/write version info
========================================================================
Add support for the overlay schema.
========================================================================
Allow cycles in schema-property-iterator
========================================================================
Add joinable properties into schema definition cycle restrictions.
========================================================================
Loosen circular references restriction for Schema Definitions.
========================================================================
Implement BackupSchemaProducer to generate a backup schema
========================================================================
Minor fix: remove a redundant log
========================================================================
Allow schema types to inherit from more than one parent
========================================================================
allow nested document properties to accept documents of subtype
========================================================================
Support polymorphism for Icing projection in Search and Get API
========================================================================
Add max_joined_child_per_parent into ResultSpec and change behavior
========================================================================
Support Icing schema type polymorphism for the search filter API
========================================================================
Verify that every child type's property set has included all compatible properties from parent types
========================================================================
Add individual type index latency
========================================================================
Build the iterator node for the propertyDefined() custom function
========================================================================
Advance all hits with same doc id from and merge sections once for the same bucket iter
========================================================================
Introduce DocHitInfoIteratorPropertyInSchema for property existence check
========================================================================
Add SchemaUtil::BuildTransitiveInheritanceGraph to build an inheritance map from schema
========================================================================
Introduce a lookup method for a property defined in a schema
========================================================================
Rollback of: Allow LanguageSegmenter::Iterators to declare AccessType.
========================================================================
Adds join info to QueryStatsProto
========================================================================
Bug:280698419
Bug:280698125
Bug:280698121
Bug:280697513
Bug:276349029
Bug:272145329
Bug:270102295
Bug:269295094
Bug:268680462
Bug:265304217
Bug:259744228
Bug:259743562
Bug:256022027
Change-Id: I54cd1d22121c314f8c238d2d49f0809165dc0ca3
Diffstat (limited to 'icing/util/document-validator.cc')
-rw-r--r-- | icing/util/document-validator.cc | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/icing/util/document-validator.cc b/icing/util/document-validator.cc index ca15ee3..9d5fea7 100644 --- a/icing/util/document-validator.cc +++ b/icing/util/document-validator.cc @@ -151,15 +151,19 @@ libtextclassifier3::Status DocumentValidator::Validate( // fail, we don't need to validate the extra documents. if (property_config.data_type() == PropertyConfigProto::DataType::DOCUMENT) { - const std::string_view nested_type_expected = - property_config.schema_type(); + ICING_ASSIGN_OR_RETURN( + const std::unordered_set<SchemaTypeId>* nested_type_ids_expected, + schema_store_->GetSchemaTypeIdsWithChildren( + property_config.schema_type())); for (const DocumentProto& nested_document : property.document_values()) { - if (nested_type_expected.compare(nested_document.schema()) != 0) { + libtextclassifier3::StatusOr<SchemaTypeId> nested_document_type_id_or = + schema_store_->GetSchemaTypeId(nested_document.schema()); + if (!nested_document_type_id_or.ok() || + nested_type_ids_expected->count( + nested_document_type_id_or.ValueOrDie()) == 0) { return absl_ports::InvalidArgumentError(absl_ports::StrCat( - "Property '", property.name(), "' should have type '", - nested_type_expected, - "' but actual " - "value has type '", + "Property '", property.name(), "' should be type or subtype of '", + property_config.schema_type(), "' but actual value has type '", nested_document.schema(), "' for key: (", document.namespace_(), ", ", document.uri(), ").")); } |