Skip to content

Commit

Permalink
Merge pull request #1984 from reebhub/PHP_indexBatch1_query
Browse files Browse the repository at this point in the history
[PHP] Index Querying pages batch [Replace C# samples]
  • Loading branch information
reebhub authored Feb 23, 2025
2 parents cdaf465 + 113eb1b commit 3f58cab
Show file tree
Hide file tree
Showing 53 changed files with 10,436 additions and 37 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Commands: Delete Document

{NOTE: }

* Use `DeleteDocumentCommand` to remove a document from the database.

* In this page:

* [Example](../../../client-api/commands/documents/delete#example)
* [Syntax](../../../client-api/commands/documents/delete#syntax)

{NOTE/}

---

{PANEL: Example}

{CODE:php delete_sample@ClientApi\Commands\Documents\Delete.php /}

{PANEL/}


{PANEL: Syntax}

{CODE:php delete_interface@ClientApi\Commands\Documents\Delete.php /}

| Parameters | Type | Description |
|------------|------|-------------|
| **idOrCopy** | `string` | ID of a document to be deleted |
| **changeVector** | `string` (optional) | Entity Change Vector, used for concurrency checks (`None` to skip check) |

{PANEL/}

## Related Articles

### Commands

- [Get](../../../client-api/commands/documents/get)
- [Put](../../../client-api/commands/documents/put)
- [How to Send Multiple Commands Using a Batch](../../../client-api/commands/batches/how-to-send-multiple-commands-using-a-batch)
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
# Commands: Get Documents

{NOTE: }

* Use `GetDocumentsCommand` to retrieve documents from the database.

* In this page:
- [Get single document](../../../client-api/commands/documents/get#get-single-document)
- [Get multiple documents](../../../client-api/commands/documents/get#get-multiple-documents)
- [Get paged documents](../../../client-api/commands/documents/get#get-paged-documents)
- [Get documents by ID prefix](../../../client-api/commands/documents/get#get-documents-by-id-prefix)

{NOTE/}

---

{PANEL: Get single document}

**GetDocumentsCommand** can be used to retrieve a single document

#### Syntax:

{CODE:php get_interface_single@ClientApi\Commands\Documents\Get.php /}

| Parameters | Type | Description |
|------------|------|-------------|
| **id** | `string` | ID of the documents to get |
| **includes** | `StringArray` or `array` or `null` | Related documents to fetch along with the document |
| **metadataOnly** | `bool` | Whether to fetch the whole document or just its metadata. |

---

#### Example:

{CODE:php get_sample_single@ClientApi\Commands\Documents\Get.php /}

{PANEL/}

{PANEL: Get multiple documents}

**GetDocumentsCommand** can also be used to retrieve a list of documents.

#### Syntax:

{CODE:php get_interface_multiple@ClientApi\Commands\Documents\Get.php /}

| Parameters | Type | Description |
|------------|------|-------------|
| **ids** | `StringArray` or `array` or `null` | IDs of the documents to get |
| **includes** | `StringArray` or `array` or `null` | Related documents to fetch along with the documents |
| **metadataOnly** | `bool` | Whether to fetch whole documents or just the metadata |

---

#### Example I

{CODE:php get_sample_multiple@ClientApi\Commands\Documents\Get.php /}

#### Example II - Using Includes

{CODE:php get_sample_includes@ClientApi\Commands\Documents\Get.php /}

#### Example III - Missing Documents

{CODE:php get_sample_missing@ClientApi\Commands\Documents\Get.php /}

{PANEL/}

{PANEL: Get paged documents}

**GetDocumentsCommand** can also be used to retrieve a paged set of documents.

#### Syntax:

{CODE:php get_interface_paged@ClientApi\Commands\Documents\Get.php /}

| Parameters | Type | Description |
|------------|------|-------------|
| **start** | `int` | number of documents that should be skipped |
| **pageSize** | `int` | maximum number of documents that will be retrieved |

---

#### Example:

{CODE:php get_sample_paged@ClientApi\Commands\Documents\Get.php /}

{PANEL/}

{PANEL: Get documents by ID prefix}

**GetDocumentsCommand** can be used to retrieve multiple documents for a specified ID prefix.

#### Syntax:

{CODE:php get_interface_startswith@ClientApi\Commands\Documents\Get.php /}

| Parameters | Type | Description |
|------------|------|-------------|
| **startWith** | `?string` | prefix for which documents should be returned |
| **startAfter** | `?string` | skip 'document fetching' until the given ID is found, and return documents after that ID (default: None) |
| **matches** | `?string` | pipe ('|') separated values for which document IDs (after `startWith`) should be matched ('?' any single character, '*' any characters) |
| **exclude** | `?string` | pipe ('|') separated values for which document IDs (after `startWith`) should **not** be matched ('?' any single character, '*' any characters) |
| **start** | `int` | number of documents that should be skipped |
| **pageSize** | `int` | maximum number of documents that will be retrieved |
| **metadataOnly** | `bool` | specifies whether or not only document metadata should be returned |

---

#### Example I

{CODE:php get_sample_startswith@ClientApi\Commands\Documents\Get.php /}

#### Example II

{CODE:php get_sample_startswith_matches@ClientApi\Commands\Documents\Get.php /}

#### Example III

{CODE:php get_sample_startswith_matches_end@ClientApi\Commands\Documents\Get.php /}

{PANEL/}

## Related Articles

### Commands

- [Put](../../../client-api/commands/documents/put)
- [Delete](../../../client-api/commands/documents/delete)
- [How to Send Multiple Commands Using a Batch](../../../client-api/commands/batches/how-to-send-multiple-commands-using-a-batch)
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Commands: Put Document
---

{NOTE: }

* Use `PutDocumentCommand` to insert a document to the database or update an existing document.

* In this page:

* [Example](../../../client-api/commands/documents/put#example)
* [Syntax](../../../client-api/commands/documents/put#syntax)

{NOTE/}

---

{PANEL: Example}

{CODE:php put_sample@ClientApi\Commands\Documents\Put.php /}

{PANEL/}

{PANEL: Syntax}

{CODE:php put_interface@ClientApi\Commands\Documents\Put.php /}

| Parameters | Type | Description |
| ------------- | ------------- | ----- |
| **idOrCopy** | `string` | Unique ID under which document will be stored |
| **changeVector** | `string` (optional) | Entity changeVector, used for concurrency checks (`None` to skip check) |
| **document** | `array` | The document to store |

{PANEL/}

## Related Articles

### Commands

- [Get](../../../client-api/commands/documents/get)
- [Delete](../../../client-api/commands/documents/delete)
- [How to Send Multiple Commands Using a Batch](../../../client-api/commands/batches/how-to-send-multiple-commands-using-a-batch)
Loading

0 comments on commit 3f58cab

Please sign in to comment.