aboutsummaryrefslogtreecommitdiff
path: root/icing/schema/property-util.cc
diff options
context:
space:
mode:
authorGrace Zhao <gracezrx@google.com>2023-06-28 15:35:44 -0700
committerGrace Zhao <gracezrx@google.com>2023-06-28 22:39:16 +0000
commitb8e8a914804b5ef6ee8ca77a9ca7b9797fe55e94 (patch)
treefa0309938bf2b0d5155b94cb2516cb3142536556 /icing/schema/property-util.cc
parent3a5d5836780120152cfade6a77ba233efbac5070 (diff)
parentf1f564329ad560f580c03f9e928057ad4e4fadc9 (diff)
downloadicing-b8e8a914804b5ef6ee8ca77a9ca7b9797fe55e94.tar.gz
Merge remote-tracking branch 'aosp/upstream-master' into androidx-main
* aosp/upstream-master: Update Icing from upstream. Descriptions: ======================================================================== [Join][cleanup][ez] Rename QualifiedIdTypeJoinableIndex as QualifiedIdJoinIndex ======================================================================== Better evaluation for persistent hash map size in join index ======================================================================== Add num_to_score into ResultSpecProto ======================================================================== [Indexable_nested_properties_list 1/5] Add indexable_nested_properties to DocumentIndexingConfig and check it during schema validation. ======================================================================== [Indexable_nested_properties_list 2/5] Add check for indexable_neseted_properties when computing SchemaDelta ======================================================================== [Indexable_nested_properties_list 3/5] Add indexable_nested_properties to schema-property-iterator ======================================================================== [Indexable_nested_properties_list 4/5] Integrate circular schema definitions with schema-property-iterator ======================================================================== Bug: 272145329 Bug: 284232550 Bug: 285636503 Bug: 265304217 Bug: 289150947 Change-Id: Icfcd4901015b75f4af2d231f8a8613c6e33034a0
Diffstat (limited to 'icing/schema/property-util.cc')
-rw-r--r--icing/schema/property-util.cc19
1 files changed, 17 insertions, 2 deletions
diff --git a/icing/schema/property-util.cc b/icing/schema/property-util.cc
index 7370328..67ff748 100644
--- a/icing/schema/property-util.cc
+++ b/icing/schema/property-util.cc
@@ -16,11 +16,9 @@
#include <string>
#include <string_view>
-#include <utility>
#include <vector>
#include "icing/text_classifier/lib3/utils/base/statusor.h"
-#include "icing/absl_ports/canonical_errors.h"
#include "icing/absl_ports/str_cat.h"
#include "icing/absl_ports/str_join.h"
#include "icing/proto/document.pb.h"
@@ -85,6 +83,23 @@ std::vector<PropertyInfo> ParsePropertyPathExpr(
return property_infos;
}
+bool IsParentPropertyPath(std::string_view property_path_expr1,
+ std::string_view property_path_expr2) {
+ if (property_path_expr2.length() < property_path_expr1.length()) {
+ return false;
+ }
+ if (property_path_expr1 !=
+ property_path_expr2.substr(0, property_path_expr1.length())) {
+ return false;
+ }
+ if (property_path_expr2.length() > property_path_expr1.length() &&
+ property_path_expr2[property_path_expr1.length()] !=
+ kPropertyPathSeparator[0]) {
+ return false;
+ }
+ return true;
+}
+
const PropertyProto* GetPropertyProto(const DocumentProto& document,
std::string_view property_name) {
for (const PropertyProto& property : document.properties()) {