diff --git a/modules/concept-docs/pages/transactions.adoc b/modules/concept-docs/pages/transactions.adoc index 1e83a962..45448f4b 100644 --- a/modules/concept-docs/pages/transactions.adoc +++ b/modules/concept-docs/pages/transactions.adoc @@ -20,7 +20,7 @@ include::{version-common}@sdk:shared:partial$acid-transactions.adoc[tags=intro] [source,php] ---- -include::howtos:example$transactions-example.php[tag=create-simple,indent=0] +include::devguide:example$php/transactions-example.php[tag=create-simple,indent=0] ---- include::{version-common}@sdk:shared:partial$acid-transactions.adoc[tags=mechanics;!library-cleanup-process] @@ -36,7 +36,7 @@ The application can use this to signal why it triggered a rollback, as so: [source,php] ---- -include::howtos:example$transactions-example.php[tag=rollback-cause,indent=0] +include::devguide:example$php/transactions-example.php[tag=rollback-cause,indent=0] ---- After a transaction is rolled back, it cannot be committed, no further operations are allowed on it, and the system will not try to automatically commit it at the end of the code block. @@ -56,14 +56,14 @@ include::{version-common}@sdk:shared:partial$acid-transactions.adoc[tag=concurre // //[source,python] //---- -//include::howtos:example$transactions_example.py[tag=custom_metadata,indent=0] +//include::devguide:example$php/transactions_example.py[tag=custom_metadata,indent=0] //---- // //or at an individual transaction level with: // //[source,java] //---- -//include::howtos:example$transactions_example.py[tag=custom_metadata_per,indent=0] +//include::devguide:example$php/transactions_example.py[tag=custom_metadata_per,indent=0] //---- // //include::{version-common}@sdk:shared:partial$acid-transactions.adoc[tag=integrated-sdk-custom-metadata-2] \ No newline at end of file diff --git a/modules/devguide/examples b/modules/devguide/examples deleted file mode 160000 index 6a59c83d..00000000 --- a/modules/devguide/examples +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 6a59c83df2b42155a17f91c06dfa34e6b9d44d6b diff --git a/modules/howtos/examples/analytics.php b/modules/devguide/examples/php/analytics.php similarity index 100% rename from modules/howtos/examples/analytics.php rename to modules/devguide/examples/php/analytics.php diff --git a/modules/howtos/examples/auth.php b/modules/devguide/examples/php/auth.php similarity index 100% rename from modules/howtos/examples/auth.php rename to modules/devguide/examples/php/auth.php diff --git a/modules/howtos/examples/batch.php b/modules/devguide/examples/php/batch.php similarity index 100% rename from modules/howtos/examples/batch.php rename to modules/devguide/examples/php/batch.php diff --git a/modules/hello-world/examples/cloud.php b/modules/devguide/examples/php/cloud.php similarity index 100% rename from modules/hello-world/examples/cloud.php rename to modules/devguide/examples/php/cloud.php diff --git a/modules/howtos/examples/collection-manager.php b/modules/devguide/examples/php/collection-manager.php similarity index 100% rename from modules/howtos/examples/collection-manager.php rename to modules/devguide/examples/php/collection-manager.php diff --git a/modules/concept-docs/examples/collections-concept.php b/modules/devguide/examples/php/collections-concept.php similarity index 100% rename from modules/concept-docs/examples/collections-concept.php rename to modules/devguide/examples/php/collections-concept.php diff --git a/modules/howtos/examples/connections.php b/modules/devguide/examples/php/connections.php similarity index 100% rename from modules/howtos/examples/connections.php rename to modules/devguide/examples/php/connections.php diff --git a/modules/howtos/examples/customer123.json b/modules/devguide/examples/php/customer123.json similarity index 100% rename from modules/howtos/examples/customer123.json rename to modules/devguide/examples/php/customer123.json diff --git a/modules/concept-docs/examples/documents-concept.php b/modules/devguide/examples/php/documents-concept.php similarity index 100% rename from modules/concept-docs/examples/documents-concept.php rename to modules/devguide/examples/php/documents-concept.php diff --git a/modules/howtos/examples/durability.php b/modules/devguide/examples/php/durability.php similarity index 100% rename from modules/howtos/examples/durability.php rename to modules/devguide/examples/php/durability.php diff --git a/modules/howtos/examples/errors.php b/modules/devguide/examples/php/errors.php similarity index 100% rename from modules/howtos/examples/errors.php rename to modules/devguide/examples/php/errors.php diff --git a/modules/howtos/examples/kv-counter.php b/modules/devguide/examples/php/kv-counter.php similarity index 100% rename from modules/howtos/examples/kv-counter.php rename to modules/devguide/examples/php/kv-counter.php diff --git a/modules/howtos/examples/kv-crud.php b/modules/devguide/examples/php/kv-crud.php similarity index 100% rename from modules/howtos/examples/kv-crud.php rename to modules/devguide/examples/php/kv-crud.php diff --git a/modules/howtos/examples/kv-expiry.php b/modules/devguide/examples/php/kv-expiry.php similarity index 100% rename from modules/howtos/examples/kv-expiry.php rename to modules/devguide/examples/php/kv-expiry.php diff --git a/modules/howtos/examples/logging.php b/modules/devguide/examples/php/logging.php similarity index 100% rename from modules/howtos/examples/logging.php rename to modules/devguide/examples/php/logging.php diff --git a/modules/howtos/examples/managing-connections.php b/modules/devguide/examples/php/managing-connections.php similarity index 100% rename from modules/howtos/examples/managing-connections.php rename to modules/devguide/examples/php/managing-connections.php diff --git a/modules/concept-docs/examples/n1ql-concept.php b/modules/devguide/examples/php/n1ql-concept.php similarity index 100% rename from modules/concept-docs/examples/n1ql-concept.php rename to modules/devguide/examples/php/n1ql-concept.php diff --git a/modules/howtos/examples/orphan-logging.php b/modules/devguide/examples/php/orphan-logging.php similarity index 100% rename from modules/howtos/examples/orphan-logging.php rename to modules/devguide/examples/php/orphan-logging.php diff --git a/modules/howtos/examples/provisioning-resources-buckets.php b/modules/devguide/examples/php/provisioning-resources-buckets.php similarity index 100% rename from modules/howtos/examples/provisioning-resources-buckets.php rename to modules/devguide/examples/php/provisioning-resources-buckets.php diff --git a/modules/howtos/examples/provisioning-resources-users.php b/modules/devguide/examples/php/provisioning-resources-users.php similarity index 100% rename from modules/howtos/examples/provisioning-resources-users.php rename to modules/devguide/examples/php/provisioning-resources-users.php diff --git a/modules/howtos/examples/query-index-manager.php b/modules/devguide/examples/php/query-index-manager.php similarity index 100% rename from modules/howtos/examples/query-index-manager.php rename to modules/devguide/examples/php/query-index-manager.php diff --git a/modules/howtos/examples/query.php b/modules/devguide/examples/php/query.php similarity index 100% rename from modules/howtos/examples/query.php rename to modules/devguide/examples/php/query.php diff --git a/modules/howtos/examples/search-facets.php b/modules/devguide/examples/php/search-facets.php similarity index 100% rename from modules/howtos/examples/search-facets.php rename to modules/devguide/examples/php/search-facets.php diff --git a/modules/howtos/examples/search.php b/modules/devguide/examples/php/search.php similarity index 100% rename from modules/howtos/examples/search.php rename to modules/devguide/examples/php/search.php diff --git a/modules/hello-world/examples/start-using.php b/modules/devguide/examples/php/start-using.php similarity index 100% rename from modules/hello-world/examples/start-using.php rename to modules/devguide/examples/php/start-using.php diff --git a/modules/howtos/examples/subdoc-concurrent.php b/modules/devguide/examples/php/subdoc-concurrent.php similarity index 100% rename from modules/howtos/examples/subdoc-concurrent.php rename to modules/devguide/examples/php/subdoc-concurrent.php diff --git a/modules/howtos/examples/subdoc-counters.php b/modules/devguide/examples/php/subdoc-counters.php similarity index 100% rename from modules/howtos/examples/subdoc-counters.php rename to modules/devguide/examples/php/subdoc-counters.php diff --git a/modules/howtos/examples/subdoc-lookupin.php b/modules/devguide/examples/php/subdoc-lookupin.php similarity index 100% rename from modules/howtos/examples/subdoc-lookupin.php rename to modules/devguide/examples/php/subdoc-lookupin.php diff --git a/modules/howtos/examples/subdoc-mutatein-arrays.php b/modules/devguide/examples/php/subdoc-mutatein-arrays.php similarity index 100% rename from modules/howtos/examples/subdoc-mutatein-arrays.php rename to modules/devguide/examples/php/subdoc-mutatein-arrays.php diff --git a/modules/howtos/examples/subdoc-mutatein-durability.php b/modules/devguide/examples/php/subdoc-mutatein-durability.php similarity index 100% rename from modules/howtos/examples/subdoc-mutatein-durability.php rename to modules/devguide/examples/php/subdoc-mutatein-durability.php diff --git a/modules/howtos/examples/subdoc-mutatein.php b/modules/devguide/examples/php/subdoc-mutatein.php similarity index 100% rename from modules/howtos/examples/subdoc-mutatein.php rename to modules/devguide/examples/php/subdoc-mutatein.php diff --git a/modules/howtos/examples/threshold-logging.php b/modules/devguide/examples/php/threshold-logging.php similarity index 100% rename from modules/howtos/examples/threshold-logging.php rename to modules/devguide/examples/php/threshold-logging.php diff --git a/modules/howtos/examples/transactions-example.php b/modules/devguide/examples/php/transactions-example.php similarity index 100% rename from modules/howtos/examples/transactions-example.php rename to modules/devguide/examples/php/transactions-example.php diff --git a/modules/howtos/examples/transcoding.php b/modules/devguide/examples/php/transcoding.php similarity index 100% rename from modules/howtos/examples/transcoding.php rename to modules/devguide/examples/php/transcoding.php diff --git a/modules/howtos/examples/using-cas.php b/modules/devguide/examples/php/using-cas.php similarity index 100% rename from modules/howtos/examples/using-cas.php rename to modules/devguide/examples/php/using-cas.php diff --git a/modules/hello-world/pages/start-using-sdk.adoc b/modules/hello-world/pages/start-using-sdk.adoc index 5a4a1dce..d17b4824 100644 --- a/modules/hello-world/pages/start-using-sdk.adoc +++ b/modules/hello-world/pages/start-using-sdk.adoc @@ -33,7 +33,7 @@ If you are connecting to https://docs.couchbase.com/cloud/index.html[Couchbase C [source,php] ---- -include::hello-world:example$cloud.php[tags=**] +include::devguide:example$php/cloud.php[tags=**] ---- The Couchbase Capella free tier version comes with the Travel Sample Bucket, and its Query indexes, loaded and ready. @@ -44,7 +44,7 @@ Local Couchbase Server:: -- [source,php] ---- -include::hello-world:example$start-using.php[tags=**] +include::devguide:example$php/start-using.php[tags=**] ---- As well as the PHP SDK (see below), and a running instance of Couchbase Server, you will need to load up the Travel Sample Bucket @@ -164,7 +164,7 @@ Firstly, you will need to have a few `import` statements at the top of your PHP [#imports] [source,php] ---- -include::hello-world:example$start-using.php[tag=imports] +include::devguide:example$php/start-using.php[tag=imports] ---- === Connect diff --git a/modules/howtos/pages/analytics-using-sdk.adoc b/modules/howtos/pages/analytics-using-sdk.adoc index e4ba83e1..f49be838 100644 --- a/modules/howtos/pages/analytics-using-sdk.adoc +++ b/modules/howtos/pages/analytics-using-sdk.adoc @@ -55,7 +55,7 @@ Alternatively, the query may be performed with named parameters: [source,php] ---- -include::example$analytics.php[tag=named] +include::devguide:example$php/analytics.php[tag=named] ---- NOTE: As timeouts are propagated to the server by the client, a timeout set on the client side may be used to stop the processing of a request, in order to save system resources. @@ -80,7 +80,7 @@ Here, we set a custom, server-side timeout value: [source,php] ---- -include::example$analytics.php[tag=options] +include::devguide:example$php/analytics.php[tag=options] ---- @@ -92,7 +92,7 @@ as you will have seen when working through our xref:{version-server}@server:anal [source,php] ---- -include::example$analytics.php[tag=results] +include::devguide:example$php/analytics.php[tag=results] ---- // Move these to Error reference doc? @@ -115,7 +115,7 @@ Here is a snippet using several items of metadata [source,php] ---- -include::example$analytics.php[tag=metadata] +include::devguide:example$php/analytics.php[tag=metadata] ---- @@ -139,7 +139,7 @@ We can then query the Dataset as normal, using the fully qualified keyspace: [source,php] ---- -include::example$analytics.php[tag=handle-collection,indent=0] +include::devguide:example$php/analytics.php[tag=handle-collection,indent=0] ---- Note that using the `CREATE DATASET` syntax we could choose any Dataset name in any Dataverse, including the default. @@ -147,5 +147,5 @@ However the SDK supports this standard convention, allowing us to query from the [source,php] ---- -include::example$analytics.php[tag=handle-scope,indent=0] +include::devguide:example$php/analytics.php[tag=handle-scope,indent=0] ---- diff --git a/modules/howtos/pages/collecting-information-and-logging.adoc b/modules/howtos/pages/collecting-information-and-logging.adoc index 204eefab..84dfd699 100644 --- a/modules/howtos/pages/collecting-information-and-logging.adoc +++ b/modules/howtos/pages/collecting-information-and-logging.adoc @@ -30,7 +30,7 @@ For example, the script below: [source,php] ---- -include::example$logging.php[tag=logging, indent=0] +include::devguide:example$php/logging.php[tag=logging, indent=0] ---- ...along with this `php.ini` snippet: diff --git a/modules/howtos/pages/concurrent-async-apis.adoc b/modules/howtos/pages/concurrent-async-apis.adoc index e8bbd0f1..dea0d688 100644 --- a/modules/howtos/pages/concurrent-async-apis.adoc +++ b/modules/howtos/pages/concurrent-async-apis.adoc @@ -76,7 +76,7 @@ you can find the default locations for other Operating Systems in our xref:https [source,php] ---- -include::example$batch.php[tag=loading] +include::devguide:example$php/batch.php[tag=loading] ---- Here we've unzipped the zip file containing the dataset and then set up the relevant number of batches, @@ -91,7 +91,7 @@ The parent then uses `pcntl_waitpid` to wait for each child process to complete. [source,php] ---- -include::example$batch.php[tag=batching] +include::devguide:example$php/batch.php[tag=batching] ---- In the output we can see something like: diff --git a/modules/howtos/pages/concurrent-document-mutations.adoc b/modules/howtos/pages/concurrent-document-mutations.adoc index f139e7cb..5c096f31 100644 --- a/modules/howtos/pages/concurrent-document-mutations.adoc +++ b/modules/howtos/pages/concurrent-document-mutations.adoc @@ -14,7 +14,7 @@ include::{version-common}@sdk:shared:partial$cas.adoc[tag=errors] [source,php] ---- -include::example$using-cas.php[tag=increment] +include::devguide:example$php/using-cas.php[tag=increment] ---- Sometimes more logic is needed when performing updates, for example, if a property is mutually exclusive with another property; only one or the other can exist, but not both. @@ -28,7 +28,7 @@ include::{version-common}@sdk:shared:partial$cas.adoc[tag=locking] [source,php] ---- -include::example$using-cas.php[tag=locking] +include::devguide:example$php/using-cas.php[tag=locking] ---- The handler will unlock the item either via an explicit unlock operation ([.api]`unlock`) or implicitly via modifying the item with the correct CAS. diff --git a/modules/howtos/pages/distributed-acid-transactions-from-the-sdk.adoc b/modules/howtos/pages/distributed-acid-transactions-from-the-sdk.adoc index 422ad5ac..640b4624 100644 --- a/modules/howtos/pages/distributed-acid-transactions-from-the-sdk.adoc +++ b/modules/howtos/pages/distributed-acid-transactions-from-the-sdk.adoc @@ -51,7 +51,7 @@ include::{version-common}@sdk:shared:partial$acid-transactions.adoc[tag=creating [source,php] ---- -include::example$transactions-example.php[tag=examples,indent=0] +include::devguide:example$php/transactions-example.php[tag=examples,indent=0] ---- include::{version-common}@sdk:shared:partial$acid-transactions.adoc[tag={lambda}-ctx] @@ -66,7 +66,7 @@ To aid troubleshooting, raise the log level on the SDK. //[source,java] //---- -//include::example$TransactionsExample.java[tag=logging,indent=0] +//include::devguide:example$php/TransactionsExample.java[tag=logging,indent=0] //---- // //A failed transaction can involve dozens, even hundreds, of lines of logging, so the application may prefer to write failed transactions into a separate file. @@ -75,7 +75,7 @@ To aid troubleshooting, raise the log level on the SDK. //This will log all lines of any failed transactions, to `WARN` level: //[source,java] //---- -//include::example$TransactionsExample.java[tag=config_warn,indent=0] +//include::devguide:example$php/TransactionsExample.java[tag=config_warn,indent=0] //---- // @@ -104,7 +104,7 @@ To insert a document within a transaction {lambda}, simply call `ctx.insert()`. [source,php] ---- -include::example$transactions-example.php[tag=insert,indent=0] +include::devguide:example$php/transactions-example.php[tag=insert,indent=0] ---- === Get @@ -113,7 +113,7 @@ From a transaction context you may get a document: [source,php] ---- -include::example$transactions-example.php[tag=get,indent=0] +include::devguide:example$php/transactions-example.php[tag=get,indent=0] ---- If the document does not exist, the transaction will fail with a `TransactionFailedException` (after rolling back any changes, of course). @@ -122,7 +122,7 @@ Gets will "Read Your Own Writes", e.g. this will succeed: [source,php] ---- -include::example$transactions-example.php[tag=getReadOwnWrites,indent=0] +include::devguide:example$php/transactions-example.php[tag=getReadOwnWrites,indent=0] ---- === Replace @@ -132,7 +132,7 @@ This is necessary so the SDK can check that the document is not involved in anot [source,php] ---- -include::example$transactions-example.php[tag=replace,indent=0] +include::devguide:example$php/transactions-example.php[tag=replace,indent=0] ---- === Remove @@ -141,7 +141,7 @@ As with replaces, removing a document requires a `$ctx->get()` call first. [source,php] ---- -include::example$transactions-example.php[tag=remove,indent=0] +include::devguide:example$php/transactions-example.php[tag=remove,indent=0] ---- == {sqlpp} Queries @@ -158,7 +158,7 @@ Here is an example of selecting some rows from the `travel-sample` bucket: [source,php] ---- -include::example$transactions-example.php[tag=queryExamplesSelect,indent=0] +include::devguide:example$php/transactions-example.php[tag=queryExamplesSelect,indent=0] ---- // TODO: Scope reference stuff doesn't seem to work (marked as deprecated?) @@ -167,21 +167,21 @@ include::example$transactions-example.php[tag=queryExamplesSelect,indent=0] // [source,php] // ---- -// include::example$transactions-example.php[tag=queryExamplesSelectScope,indent=0] +// include::devguide:example$php/transactions-example.php[tag=queryExamplesSelectScope,indent=0] // ---- // An example using a `Scope` for an UPDATE: // [source,php] // ---- -// include::example$transactions-example.php[tag=queryExamplesUpdate,indent=0] +// include::devguide:example$php/transactions-example.php[tag=queryExamplesUpdate,indent=0] // ---- And an example combining `SELECT` and an `UPDATE`. [source,php] ---- -include::example$transactions-example.php[tag=queryExamplesComplex,indent=0] +include::devguide:example$php/transactions-example.php[tag=queryExamplesComplex,indent=0] ---- As you can see from the snippet above, it is possible to call regular PHP functions from the {lambda}, permitting complex logic to be performed. @@ -192,7 +192,7 @@ This example shows inserting a document and then selecting it again: [source,php] ---- -include::example$transactions-example.php[tag=queryRYOW,indent=0] +include::devguide:example$php/transactions-example.php[tag=queryRYOW,indent=0] ---- <1> The inserted document is only staged at this point, as the transaction has not yet committed. + Other transactions, and other non-transactional actors, will not be able to see this staged insert yet. @@ -204,7 +204,7 @@ Query options can be provided via `TransactionQueryOptions`, which provides a su [source,php] ---- -include::example$transactions-example.php[tag=queryOptions,indent=0] +include::devguide:example$php/transactions-example.php[tag=queryOptions,indent=0] ---- .Supported Transaction Query Options @@ -233,7 +233,7 @@ In this example we insert a document with a key-value operation, and read it wit [source,php] ---- -include::example$transactions-example.php[tag=queryKvMix,indent=0] +include::devguide:example$php/transactions-example.php[tag=queryKvMix,indent=0] ---- <1> The key-value insert operation is only staged, and so it is not visible to other transactions or non-transactional actors. @@ -246,7 +246,7 @@ For example, if you want to change the level of durability which must be attaine [source,php] ---- -include::example$transactions-example.php[tag=config,indent=0] +include::devguide:example$php/transactions-example.php[tag=config,indent=0] ---- include::{version-common}@sdk:shared:partial$acid-transactions.adoc[tag=config] diff --git a/modules/howtos/pages/error-handling.adoc b/modules/howtos/pages/error-handling.adoc index ec693665..06b454e4 100644 --- a/modules/howtos/pages/error-handling.adoc +++ b/modules/howtos/pages/error-handling.adoc @@ -55,7 +55,7 @@ Transient errors -- such as those caused by resource starvation -- are best tack [source,php] ---- -include::example$errors.php[tag=retry] +include::devguide:example$php/errors.php[tag=retry] ---- == Key-Value Errors @@ -68,7 +68,7 @@ If a particular key cannot be found it is raised as a `DocumentNotFoundException [source,php] ---- -include::example$errors.php[tag=document-not-found-exception] +include::devguide:example$php/errors.php[tag=document-not-found-exception] ---- === Key already exists @@ -77,14 +77,14 @@ On the other hand if the key already exists and should not (e.g. on an insert) t [source,php] ---- -include::example$errors.php[tag=key-exists-exception] +include::devguide:example$php/errors.php[tag=key-exists-exception] ---- === Document body too large [source,php] ---- -include::example$errors.php[tag=value-too-big-exception] +include::devguide:example$php/errors.php[tag=value-too-big-exception] ---- === Concurrency @@ -94,7 +94,7 @@ When you get a document you automatically receive its CAS value, and when replac [source,php] ---- -include::example$errors.php[tag=cas-mismatch-exception, indent=0] +include::devguide:example$php/errors.php[tag=cas-mismatch-exception, indent=0] ---- @@ -113,7 +113,7 @@ For instance, for inserts, they can simply be retried to see if they fail on `Do [source,scala] ---- -include::example$ErrorHandling.scala[tag=insert,indent=0] +include::devguide:example$php/ErrorHandling.scala[tag=insert,indent=0] ---- That example is much closer to what an application will want to be doing. Let's flesh it out further. @@ -123,7 +123,7 @@ The application can write wrappers so that it can easily do operations without h [source,scala] ---- -include::example$ErrorHandling.scala[tag=insert-real,indent=0] +include::devguide:example$php/ErrorHandling.scala[tag=insert-real,indent=0] ---- This will make a 'best effort' to do the insert (though its retry strategy is rather naive, and applications may want to implement a more sophisticated approach involving exponential backoff and circuit breaking.) @@ -147,7 +147,7 @@ A SQL++ query either returns results or `QueryError`, like so: [source,scala] ---- -include::example$ErrorHandling.scala[tag=query,indent=0] +include::devguide:example$php/ErrorHandling.scala[tag=query,indent=0] ---- Analytics works in an identical fashion, raising an `AnalyticsError`. diff --git a/modules/howtos/pages/full-text-searching-with-sdk.adoc b/modules/howtos/pages/full-text-searching-with-sdk.adoc index d72a2958..fc23ba3b 100644 --- a/modules/howtos/pages/full-text-searching-with-sdk.adoc +++ b/modules/howtos/pages/full-text-searching-with-sdk.adoc @@ -33,7 +33,7 @@ For the purposes of the below examples we will use the Travel Sample bucket with [source,json] ---- -include::example$search.php[tag=indexdefinition] +include::devguide:example$php/search.php[tag=indexdefinition] ---- Search queries are executed at Cluster level (not bucket or collection). As of Couchbase Server 6.5+ they do also not @@ -44,7 +44,7 @@ Here is a simple MatchQuery that looks for the text “swanky” using a defined [source,php] ---- -include::example$search.php[tag=matchquery] +include::devguide:example$php/search.php[tag=matchquery] ---- All simple query types are created in the same manner, although some have additional properties, which can be seen in @@ -55,7 +55,7 @@ Here is a numeric range query that looks for hotels with `"Cleanliness"` ratings [source,php] ---- -include::example$search.php[tag=numrangequery] +include::devguide:example$php/search.php[tag=numrangequery] ---- Queries can also be combined together. @@ -63,7 +63,7 @@ A conjunction query contains multiple child queries; its result documents must s [source,php] ---- -include::example$search.php[tag=conjunctionquery] +include::devguide:example$php/search.php[tag=conjunctionquery] ---- [TIP] @@ -103,7 +103,7 @@ Facets can only be accessed once `Close` has been called on rows. [source,php] ---- -include::example$search-facets.php[tag=iteratingfacets] +include::devguide:example$php/search-facets.php[tag=iteratingfacets] ---- @@ -123,7 +123,7 @@ And note that traditional FTS queries, without vector search, are also supported [source,php] ---- -include::example$search.php[tag=traditionalftsquery] +include::devguide:example$php/search.php[tag=traditionalftsquery] ---- The `SearchQuery` is created in the same way as detailed earlier. @@ -136,7 +136,7 @@ ensuring results contain information from updated indexes: [source,php] ---- -include::example$search.php[tag=consistency] +include::devguide:example$php/search.php[tag=consistency] ---- diff --git a/modules/howtos/pages/kv-operations.adoc b/modules/howtos/pages/kv-operations.adoc index ee2c9ae3..5b01b3eb 100644 --- a/modules/howtos/pages/kv-operations.adoc +++ b/modules/howtos/pages/kv-operations.adoc @@ -37,14 +37,14 @@ Here is the _Insert_ operation at its simplest: [source,php] ---- -include::example$kv-crud.php[tag=insert] +include::devguide:example$php/kv-crud.php[tag=insert] ---- Options may be added to operations: [source,php] ---- -include::example$kv-crud.php[tag=insertwithoptions] +include::devguide:example$php/kv-crud.php[tag=insertwithoptions] ---- Setting a Compare and Swap (CAS) value is a form of optimistic locking - dealt with in depth in the xref:concurrent-document-mutations.adoc[CAS page]. @@ -58,7 +58,7 @@ We will add to these options for the _Replace_ example: [source,php] ---- -include::example$kv-crud.php[tag=replacewithcas] +include::devguide:example$php/kv-crud.php[tag=replacewithcas] ---- The example above also shows how to handle the case when optimistic falure will fail. @@ -70,7 +70,7 @@ xref:{version-server}@server:learn:buckets-memory-and-storage/expiration.adoc#ex [source,php] ---- -include::example$kv-crud.php[tag=upsertwithexpiry] +include::devguide:example$php/kv-crud.php[tag=upsertwithexpiry] ---- // TODO: old-style durability will come later @@ -99,7 +99,7 @@ The following example demonstrates using the newer durability features available [source,php] ---- -include::example$kv-crud.php[tag=upsertwithdurability] +include::devguide:example$php/kv-crud.php[tag=upsertwithdurability] ---- To stress, durability is a useful feature but should not be the default for most applications, as there is a performance consideration, @@ -159,14 +159,14 @@ Using the `Get()` method with the document key can be done in a similar fashion [source,php] ---- -include::example$kv-crud.php[tag=get] +include::devguide:example$php/kv-crud.php[tag=get] ---- Timeout can also be set - as in the earlier `Insert` example: [source,php] ---- -include::example$kv-crud.php[tag=getwithoptions] +include::devguide:example$php/kv-crud.php[tag=getwithoptions] ---- @@ -177,7 +177,7 @@ When removing a document, you will have the same concern for durability as with Remove (with options) [source,php] ---- -include::example$kv-crud.php[tag=removewithoptions] +include::devguide:example$php/kv-crud.php[tag=removewithoptions] ---- // TODO: old-style durability will come later @@ -191,21 +191,21 @@ NOTE: Increment & Decrement are considered part of the ‘binary’ API and as s [source,php] ---- -include::example$kv-expiry.php[tag=touch] +include::devguide:example$php/kv-expiry.php[tag=touch] ---- A network timeout can be set with the optional `TouchOptions()`, in the same fashion as earlier examples on this page: [source,php] ---- -include::example$kv-expiry.php[tag=touchwithoptions] +include::devguide:example$php/kv-expiry.php[tag=touchwithoptions] ---- Another way to change expiration time is to use `getAndTouch()` method of the collection. [source,php] ---- -include::example$kv-expiry.php[tag=getandtouch] +include::devguide:example$php/kv-expiry.php[tag=getandtouch] ---- @@ -219,24 +219,24 @@ NOTE: Increment & Decrement are considered part of the ‘binary’ API and as s .Increment [source,php] ---- -include::example$kv-counter.php[tag=increment] +include::devguide:example$php/kv-counter.php[tag=increment] ---- [source,php] ---- -include::example$kv-counter.php[tag=incrementwithoptions] +include::devguide:example$php/kv-counter.php[tag=incrementwithoptions] ---- .Decrement [source,php] ---- -include::example$kv-counter.php[tag=decrement] +include::devguide:example$php/kv-counter.php[tag=decrement] ---- .Decrement (With Options) [source,php] ---- -include::example$kv-counter.php[tag=decrementwithoptions] +include::devguide:example$php/kv-counter.php[tag=decrementwithoptions] ---- TIP: Setting the document expiry time only works when a document is created, and it is not possible to update the expiry time of an existing counter document with the Increment method -- to do this during an increment, use with the `Touch()` method. @@ -262,7 +262,7 @@ Here's an example of a KV range scan that gets all documents in a collection: .KV Range Scan for all documents in a collection [source,php] ---- -include::example$kv-crud.php[tag=rangescanalldocuments] +include::devguide:example$php/kv-crud.php[tag=rangescanalldocuments] ---- <1> The `RangeScan` class has two optional parameters: `from` and `to`. @@ -282,7 +282,7 @@ For example, to get all documents associated with user "alice", you would write: .KV Range Scan for all documents in a collection whose IDs start with `alice::` [source,php] ---- -include::example$kv-crud.php[tag=rangescanprefix] +include::devguide:example$php/kv-crud.php[tag=rangescanprefix] ---- <1> Note the scan type is `PrefixScan` @@ -295,7 +295,7 @@ If you want to get random documents from a collection, use a sample scan. .KV Range Scan for 100 random documents [source,php] ---- -include::example$kv-crud.php[tag=rangescansample] +include::devguide:example$php/kv-crud.php[tag=rangescansample] ---- [#kv-range-scan-only-ids] @@ -306,7 +306,7 @@ If you only want the document IDs, set the `idsOnly()` in `ScanOptions` to `true .KV Range Scan for all document IDs in a collection [source,php] ---- -include::example$kv-crud.php[tag=rangescanalldocumentids] +include::devguide:example$php/kv-crud.php[tag=rangescanalldocumentids] ---- == Scoped KV Operations @@ -321,7 +321,7 @@ Here is an example showing an upsert in the `users` collection, which lives in t [source,php] ---- -include::example$kv-crud.php[tag=namedcollectionupsert] +include::devguide:example$php/kv-crud.php[tag=namedcollectionupsert] ---- == Additional Resources diff --git a/modules/howtos/pages/managing-connections.adoc b/modules/howtos/pages/managing-connections.adoc index 93daddaa..b7b47585 100644 --- a/modules/howtos/pages/managing-connections.adoc +++ b/modules/howtos/pages/managing-connections.adoc @@ -18,7 +18,7 @@ The simplest way to create a `Cluster` is to call `new Cluster()` with a <> option: [source,php] ---- -include::example$subdoc-mutatein-arrays.php[tag=mutateInArrayAppendCreatePath] +include::devguide:example$php/subdoc-mutatein-arrays.php[tag=mutateInArrayAppendCreatePath] ---- // TODO: SDK will have fluent API to set spec options more verbosely like isXattr(false)->withCreateParents(true) @@ -177,7 +177,7 @@ This will do a check to determine if the given value exists or not before actual [source,php] ---- -include::example$subdoc-mutatein-arrays.php[tag=mutateInArrayAddUnique] +include::devguide:example$php/subdoc-mutatein-arrays.php[tag=mutateInArrayAddUnique] ---- Note that currently the _addunique_ will fail with a _Path Mismatch_ error if the array contains JSON _floats_, _objects_, or _arrays_. @@ -194,7 +194,7 @@ For example, to insert `"cruel"` as the second element in the array `["Hello", " [source,php] ---- -include::example$subdoc-mutatein-arrays.php[tag=mutateInArrayInsert] +include::devguide:example$php/subdoc-mutatein-arrays.php[tag=mutateInArrayInsert] ---- // for your examples, above, CD: “I feel like somewhere in this we should also just a an example path like "my.path[1]" too, just to show how to use the index with a nested path. I don't think it's necessarily clear.” @@ -209,7 +209,7 @@ These operations are logically similar to the _counter_ operation on an entire d [source,php] ---- -include::example$subdoc-counters.php[tag=mutateInIncrement] +include::devguide:example$php/subdoc-counters.php[tag=mutateInIncrement] ---- The _subdoc-counter_ operation performs simple arithmetic against a numeric value, either incrementing or decrementing the existing value. @@ -217,7 +217,7 @@ The new value is returned. [source,php] ---- -include::example$subdoc-counters.php[tag=mutateInDecrement] +include::devguide:example$php/subdoc-counters.php[tag=mutateInDecrement] ---- The existing value for _subdoc-counter_ operations must be within range of a 64 bit signed integer. @@ -276,7 +276,7 @@ In this case, the _create-path_ option may be used. [source,php] ---- -include::example$subdoc-mutatein.php[tag=mutateInCreatePath] +include::devguide:example$php/subdoc-mutatein.php[tag=mutateInCreatePath] ---- // TODO: php sdk will have fluent APi for subdocument specs @@ -290,7 +290,7 @@ The `Collection->lookupinAnyReplica()` method returns the first response -- from .Sub-Document read from any replica [source,php] ---- -include::example$subdoc-lookupin.php[tag=lookupinanyreplica] +include::devguide:example$php/subdoc-lookupin.php[tag=lookupinanyreplica] ---- The `Collection->lookupInAllReplicas()` method fetches all available replicas (and the active copy), and returns all responses: @@ -298,7 +298,7 @@ The `Collection->lookupInAllReplicas()` method fetches all available replicas (a .Sub-Document read from all replicas [source,php] ---- -include::example$subdoc-lookupin.php[tag=lookupinallreplicas] +include::devguide:example$php/subdoc-lookupin.php[tag=lookupinallreplicas] ---- == CAS Semantics @@ -309,7 +309,7 @@ For example the following two operations can execute concurrently without any ri [source,php] ---- -include::example$subdoc-concurrent.php[tag=mutateInConcurrent] +include::devguide:example$php/subdoc-concurrent.php[tag=mutateInConcurrent] ---- Even when modifying the _same_ part of the document, operations will not necessarily conflict. @@ -320,7 +320,7 @@ If CAS is required then it can be provided like this: [source,php] ---- -include::example$subdoc-mutatein.php[tag=mutateInCas] +include::devguide:example$php/subdoc-mutatein.php[tag=mutateInCas] ---- == Durability @@ -329,7 +329,7 @@ In Couchbase Server 6.5 and up, this is built upon with xref:concept-docs:durabi [source,php] ---- -include::example$subdoc-mutatein-durability.php[tag=mutateInDurableWrites] +include::devguide:example$php/subdoc-mutatein-durability.php[tag=mutateInDurableWrites] ---- diff --git a/modules/howtos/pages/transcoders-nonjson.adoc b/modules/howtos/pages/transcoders-nonjson.adoc index b918d8f6..f9d630f2 100644 --- a/modules/howtos/pages/transcoders-nonjson.adoc +++ b/modules/howtos/pages/transcoders-nonjson.adoc @@ -81,21 +81,21 @@ First we will create the encoder function: [source,php] ---- -include::example$transcoding.php[tag=encoder,indent=0] +include::devguide:example$php/transcoding.php[tag=encoder,indent=0] ---- And now create a corresponding decoder function: [source,php] ---- -include::example$transcoding.php[tag=decoder,indent=0] +include::devguide:example$php/transcoding.php[tag=decoder,indent=0] ---- To use these functions with some data we can do the following and our image will be seamlessly stored in Couchbase Server: [source,php] ---- -include::example$transcoding.php[tag=usage,indent=0] +include::devguide:example$php/transcoding.php[tag=usage,indent=0] ---- == Configuration diff --git a/modules/howtos/pages/vector-searching-with-sdk.adoc b/modules/howtos/pages/vector-searching-with-sdk.adoc index e0a89194..dfdfc0b8 100644 --- a/modules/howtos/pages/vector-searching-with-sdk.adoc +++ b/modules/howtos/pages/vector-searching-with-sdk.adoc @@ -52,7 +52,7 @@ wrapped inside the {name-sdk} Query API. .Hyperscale Index Example [source,php] ---- -include::example$query.php[indent=0,tag=VectorSearchWithQueryHyperscaleIndex] +include::devguide:example$php/query.php[indent=0,tag=VectorSearchWithQueryHyperscaleIndex] ---- Parameterizing the query, as with xref:sqlpp-queries-with-sdk.adoc#parameterized-queries[regular queries], will allow the reuse of the xref:server:n1ql:n1ql-intro/queriesandresults.adoc#prepare-stmts[Query Plan]. @@ -61,7 +61,7 @@ This can be more efficient, unless you are doing a lot of optimization to your q .Parameterized Vector Query [source,php] ---- -include::example$query.php[indent=0,tag=VectorSearchWithQueryParameterized] +include::devguide:example$php/query.php[indent=0,tag=VectorSearchWithQueryParameterized] ---- @@ -82,7 +82,7 @@ Couchbase Server 7.6.0 (7.6.2 for base64-encoded vectors) — or recent Cape In this first example we are performing a single vector query: [source,php] ---- -include::example$search.php[tag=singlevectorquery] +include::devguide:example$php/search.php[tag=singlevectorquery] ---- Let's break this down. @@ -107,7 +107,7 @@ You can run multiple vector queries together: [source,php] ---- -include::example$search.php[tag=multiplevectorqueries] +include::devguide:example$php/search.php[tag=multiplevectorqueries] ---- How the results are combined (ANDed or ORed) can be controlled with `VectorSearchOptions::vectorQueryCombination()`. @@ -117,7 +117,7 @@ You can combine a traditional Search query with vector queries: [source,php] ---- -include::example$search.php[tag=combinedvectorquery] +include::devguide:example$php/search.php[tag=combinedvectorquery] ---- @@ -170,7 +170,7 @@ You can run multiple vector queries together: [source,php] ---- -include::example$search.php[indent=0,tag=multiplevectorqueries] +include::devguide:example$php/search.php[indent=0,tag=multiplevectorqueries] ---- Note that `num_candidates` sets how many similar vectors are returned. @@ -185,7 +185,7 @@ You can combine a traditional Search query with vector queries: [source,php] ---- -include::example$search.php[indent=0,tag=combinedvectorquery] +include::devguide:example$php/search.php[indent=0,tag=combinedvectorquery] ---- How the results are combined (ANDed or ORed) can be controlled with `VectorSearchOptions::vectorQueryCombination()`.