From c18e20f8329d493bedc529bb8edc510003e58316 Mon Sep 17 00:00:00 2001 From: Gary Conroy Date: Mon, 14 Apr 2025 16:51:18 +0100 Subject: [PATCH] fix: Enhance some docs instructions --- pkg/cmd/dictionary/entries/import/import.go | 3 +-- pkg/cmd/objects/import/import.go | 4 +++- pkg/cmd/objects/operations/operations.go | 2 +- pkg/cmd/objects/update/update.go | 5 +++-- pkg/cmd/rules/import/import.go | 6 +++--- pkg/cmd/synonyms/import/import.go | 4 ++-- 6 files changed, 13 insertions(+), 11 deletions(-) diff --git a/pkg/cmd/dictionary/entries/import/import.go b/pkg/cmd/dictionary/entries/import/import.go index 87221959..59eb8d6c 100644 --- a/pkg/cmd/dictionary/entries/import/import.go +++ b/pkg/cmd/dictionary/entries/import/import.go @@ -55,8 +55,7 @@ func NewImportCmd(f *cmdutil.Factory, runF func(*ImportOptions) error) *cobra.Co Short: "Import dictionary entries from a file to the specified index", Long: heredoc.Doc(` Import dictionary entries from a file to the specified index. - - The file must contains one single JSON object per line (newline delimited JSON objects - ndjson format: https://ndjson.org/). + The file must contain one JSON object per line - in newline-delimited JSON (NDJSON) format: https://ndjson.org/. `), Example: heredoc.Doc(` # Import entries from the "entries.ndjson" file to the "stopwords" dictionary diff --git a/pkg/cmd/objects/import/import.go b/pkg/cmd/objects/import/import.go index 31aadf91..7ff9079a 100644 --- a/pkg/cmd/objects/import/import.go +++ b/pkg/cmd/objects/import/import.go @@ -48,7 +48,9 @@ func NewImportCmd(f *cmdutil.Factory) *cobra.Command { Short: "Import records into an index", Long: heredoc.Doc(` Import records into the specified index from a file or the standard input. - The file must contain one JSON object per line (newline delimited JSON objects - ndjson format: https://ndjson.org/). + The file must contain one JSON object per line - in newline-delimited JSON (NDJSON) format: https://ndjson.org/. + + The CLI will create a new index if the specified index doesn't exist `), Example: heredoc.Doc(` # Import records from the "data.ndjson" file into the "MOVIES" index diff --git a/pkg/cmd/objects/operations/operations.go b/pkg/cmd/objects/operations/operations.go index 54b871bd..b1e4527a 100644 --- a/pkg/cmd/objects/operations/operations.go +++ b/pkg/cmd/objects/operations/operations.go @@ -53,7 +53,7 @@ func NewOperationsCmd(f *cmdutil.Factory, runF func(*OperationsOptions) error) * Long: heredoc.Doc(` Perform several indexing operations - The file must contains one single JSON object per line (newline delimited JSON objects - ndjson format: https://ndjson.org/). + The file must contain one JSON object per line - in newline-delimited JSON (NDJSON) format: https://ndjson.org/. Each JSON object must be a valid indexing operation, as documented in the REST API documentation: https://www.algolia.com/doc/rest-api/search/#batch-write-operations-multiple-indices `), Example: heredoc.Doc(` diff --git a/pkg/cmd/objects/update/update.go b/pkg/cmd/objects/update/update.go index fbf3fcab..8aa727d0 100644 --- a/pkg/cmd/objects/update/update.go +++ b/pkg/cmd/objects/update/update.go @@ -54,8 +54,9 @@ func NewUpdateCmd(f *cmdutil.Factory, runF func(*UpdateOptions) error) *cobra.Co Short: "Update an index with records from a file", Long: heredoc.Doc(` Update a specified index with records from a file. - - The file must contains one JSON object per line (newline delimited JSON objects - ndjson format: https://ndjson.org/). + The file must contain one JSON object per line - in newline-delimited JSON (NDJSON) format: https://ndjson.org/. + + If an attribute is missing in the import file, the original attribute value is retained. `), Example: heredoc.Doc(` # Update the "MOVIES" index with records from the "objects.ndjson" file diff --git a/pkg/cmd/rules/import/import.go b/pkg/cmd/rules/import/import.go index fdea971c..7caac2f6 100644 --- a/pkg/cmd/rules/import/import.go +++ b/pkg/cmd/rules/import/import.go @@ -49,10 +49,10 @@ func NewImportCmd(f *cmdutil.Factory, runF func(*ImportOptions) error) *cobra.Co Annotations: map[string]string{ "acls": "editSettings", }, - Short: "Import Rules into an index.", + Short: "Import rules into an index.", Long: heredoc.Doc(` - Import Rules into an index. - File imports must contain one JSON rule per line (newline delimited JSON objects - ndjson format: https://ndjson.org/). + Import rules into an index. + The file must contain one JSON object per line - in newline-delimited JSON (NDJSON) format: https://ndjson.org/. `), Example: heredoc.Doc(` # Import rules from the "rules.ndjson" file to the "MOVIES" index diff --git a/pkg/cmd/synonyms/import/import.go b/pkg/cmd/synonyms/import/import.go index 246074d5..a606b215 100644 --- a/pkg/cmd/synonyms/import/import.go +++ b/pkg/cmd/synonyms/import/import.go @@ -47,8 +47,8 @@ func NewImportCmd(f *cmdutil.Factory, runF func(*ImportOptions) error) *cobra.Co }, Short: "Import synonyms to the index", Long: heredoc.Doc(` - Import synonyms to the provided index. - The file must contains one single JSON synonym per line (newline delimited JSON objects - ndjson format: https://ndjson.org/). + Import synonyms to the specified index. + The file must contain one JSON object per line - in newline-delimited JSON (NDJSON) format: https://ndjson.org/. `), Example: heredoc.Doc(` # Import synonyms from the "synonyms.ndjson" file to the "MOVIES" index