From ed3fb38822d0dc464ea56e882a1a2111d9d6d615 Mon Sep 17 00:00:00 2001 From: John-Alan Simmons Date: Fri, 28 Feb 2025 14:00:11 -0800 Subject: [PATCH 1/3] Update secondary index guide --- docs/defradb/guides/secondary-index.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/defradb/guides/secondary-index.md b/docs/defradb/guides/secondary-index.md index 72c28ed..dc787c5 100644 --- a/docs/defradb/guides/secondary-index.md +++ b/docs/defradb/guides/secondary-index.md @@ -3,6 +3,8 @@ sidebar_label: Secondary index guide sidebar_position: 80 --- +# Secondary Indexes + ## Introduction DefraDB provides a powerful and flexible secondary indexing system that enables efficient document lookups and queries. @@ -103,7 +105,7 @@ JSON fields differ from other field types (e.g., Int, String, Bool) because they #### JSON Interface -DefraDB's JSON interface, defined in client/json.go, is essential for managing JSON fields. It allows the system to: +DefraDB's JSON interface, defined in [`client/json.go`](https://github.com/sourcenetwork/defradb/blob/master/client/json.go), is essential for managing JSON fields. It allows the system to: Traverse all leaf nodes in a JSON document. Represent a JSON value as either a complete document or a single node within the structure. @@ -157,7 +159,7 @@ When indexing a document with JSON fields, the system: ##### Query example Retrieve documents where the model is "iPhone": -``` +```graphql query { Collection(filter: { jsonField: { From 3a3ca6faf89234a444e4ef6e33ab4490511a406f Mon Sep 17 00:00:00 2001 From: John-Alan Simmons Date: Fri, 28 Feb 2025 14:01:42 -0800 Subject: [PATCH 2/3] Relationship cardinality fix --- docs/defradb/guides/secondary-index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/defradb/guides/secondary-index.md b/docs/defradb/guides/secondary-index.md index dc787c5..ca95e02 100644 --- a/docs/defradb/guides/secondary-index.md +++ b/docs/defradb/guides/secondary-index.md @@ -75,7 +75,7 @@ query { - Retrieve the corresponding User documents. This method is much faster because indexes enable direct lookups. #### Enforcing relationship cardinality -Indexes can also enforce one-to-one relationships. For instance, to ensure each User has exactly one unique Address: +Indexes can also enforce one-to-one relationships. For instance, to ensure each Address has exactly one unique User: ```graphql type User { From 571b7ec1c5bc648009539ad1f1637d03fdcaa5ad Mon Sep 17 00:00:00 2001 From: John-Alan Simmons Date: Fri, 28 Feb 2025 14:03:26 -0800 Subject: [PATCH 3/3] side bar title case --- docs/defradb/guides/secondary-index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/defradb/guides/secondary-index.md b/docs/defradb/guides/secondary-index.md index ca95e02..4272f6d 100644 --- a/docs/defradb/guides/secondary-index.md +++ b/docs/defradb/guides/secondary-index.md @@ -1,5 +1,5 @@ --- -sidebar_label: Secondary index guide +sidebar_label: Secondary Index Guide sidebar_position: 80 ---