-
Notifications
You must be signed in to change notification settings - Fork 135
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1927 from reebhub/PHP_sessionBatch2_query
[PHP] Client API session batch 2 (querying) [Replace C# samples]
- Loading branch information
Showing
62 changed files
with
6,496 additions
and
218 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
87 changes: 87 additions & 0 deletions
87
...client-api/session/querying/document-query/query-vs-document-query.php.markdown
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
# Query vs DocumentQuery | ||
|
||
--- | ||
|
||
{NOTE: } | ||
|
||
* RavenDB Queries can be executed using `query` or `document_query`, or by passing | ||
[RQL](../../../../client-api/session/querying/what-is-rql) directly to the server | ||
via `raw_query`. | ||
Learn more in [Query Overview](../../../../client-api/session/querying/how-to-query). | ||
|
||
* In the PHP client API, `query` methods and their equivalent `documentQuery` methods | ||
provide the same functionality. (This is different from the C# client implementation, | ||
which often provides different functionality for `Query` methods and their `DocumentQuery` | ||
counterparts.) | ||
The PHP documentation therefore often provides `query` usage samples without adding | ||
`documentQuery` examples as well. | ||
|
||
* In this page: | ||
* [API support](../../../../client-api/session/querying/document-query/query-vs-document-query#api-support) | ||
* [`query `and `documentQuery` equivalents](../../../../client-api/session/querying/document-query/query-vs-document-query#queryand-documentquery-equivalents) | ||
|
||
{NOTE/} | ||
|
||
--- | ||
|
||
{PANEL: API support} | ||
|
||
* `query` and `documentQquery` queries are translated to RQL and sent to the server. | ||
* Available _query_ methods are listed [here](../../../../client-api/session/querying/how-to-query#custom-methods). | ||
* Available _documentQuery_ methods and extensions are listed [here](../../../../client-api/session/querying/document-query/what-is-document-query#custom-methods-and-extensions). | ||
|
||
{PANEL/} | ||
|
||
{PANEL: `query `and `documentQuery` equivalents} | ||
|
||
#### 1. | ||
|
||
{CODE:php query_1a@ClientApi\Session\Querying\DocumentQuery\QueryVsDocumentQuery.php /} | ||
|
||
is equivalent to: | ||
|
||
{CODE:php query_1b@ClientApi\Session\Querying\DocumentQuery\QueryVsDocumentQuery.php /} | ||
|
||
--- | ||
|
||
#### 2. | ||
|
||
{CODE:php query_2a@ClientApi\Session\Querying\DocumentQuery\QueryVsDocumentQuery.php /} | ||
|
||
is equivalent to: | ||
|
||
{CODE:php query_2b@ClientApi\Session\Querying\DocumentQuery\QueryVsDocumentQuery.php /} | ||
|
||
--- | ||
|
||
#### 3. | ||
|
||
{CODE:php query_3a@ClientApi\Session\Querying\DocumentQuery\QueryVsDocumentQuery.php /} | ||
|
||
is equivalent to: | ||
|
||
{CODE:php query_3b@ClientApi\Session\Querying\DocumentQuery\QueryVsDocumentQuery.php /} | ||
|
||
--- | ||
|
||
#### 4. | ||
|
||
{CODE:php query_4a@ClientApi\Session\Querying\DocumentQuery\QueryVsDocumentQuery.php /} | ||
|
||
is equivalent to: | ||
|
||
{CODE:php query_4b@ClientApi\Session\Querying\DocumentQuery\QueryVsDocumentQuery.php /} | ||
|
||
{PANEL/} | ||
|
||
## Related Articles | ||
|
||
### Session | ||
|
||
- [Query Overview](../../../../client-api/session/querying/how-to-query) | ||
- [What is a Document Query](../../../../client-api/session/querying/document-query/what-is-document-query) | ||
- [How to use Lucene](../../../../client-api/session/querying/document-query/how-to-use-lucene) | ||
|
||
### Indexes | ||
|
||
- [Querying an Index](../../../../indexes/querying/query-index) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
169 changes: 169 additions & 0 deletions
169
.../client-api/session/querying/document-query/what-is-document-query.php.markdown
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,169 @@ | ||
# What is a Document Query? | ||
|
||
--- | ||
|
||
{NOTE: } | ||
|
||
* RavenDB queries can be executed via `query`, `documentQuery` or directly using `RQL`. | ||
Learn more in [Query Overview](../../../../client-api/session/querying/how-to-query). | ||
|
||
* See [Query -vs- documentQuery](../../../../client-api/session/querying/document-query/query-vs-document-query) | ||
for additional details. | ||
|
||
* In this page: | ||
* [documentQuery examples](../../../../client-api/session/querying/document-query/what-is-document-query#documentquery-examples) | ||
* [Custom methods](../../../../client-api/session/querying/document-query/what-is-document-query#custom-methods) | ||
* [Syntax](../../../../client-api/session/querying/document-query/what-is-document-query#syntax) | ||
|
||
{NOTE/} | ||
|
||
--- | ||
|
||
{PANEL: documentQuery examples} | ||
|
||
#### Query collection - no filtering | ||
|
||
{CODE-TABS} | ||
{CODE-TAB:php:documentQuery documentQuery_2@ClientApi\Session\Querying\DocumentQuery\WhatIsDocumentQuery.php /}) | ||
{CODE-TAB-BLOCK:sql:RQL} | ||
from "Employees" | ||
{CODE-TAB-BLOCK/} | ||
{CODE-TABS/} | ||
|
||
--- | ||
|
||
#### Query collection - with filtering | ||
|
||
{CODE-TABS} | ||
{CODE-TAB:php:documentQuery documentQuery_3@ClientApi\Session\Querying\DocumentQuery\WhatIsDocumentQuery.php /}) | ||
{CODE-TAB-BLOCK:sql:RQL} | ||
from "Employees" where FirstName == "Robert" | ||
{CODE-TAB-BLOCK/} | ||
{CODE-TABS/} | ||
|
||
--- | ||
|
||
#### Query an index | ||
|
||
* Using a Path string | ||
{CODE:php documentQuery_4@ClientApi\Session\Querying\DocumentQuery\WhatIsDocumentQuery.php /}) | ||
|
||
* Using an index Class | ||
{CODE:php documentQuery_5@ClientApi\Session\Querying\DocumentQuery\WhatIsDocumentQuery.php /}) | ||
|
||
{NOTE: } | ||
Please refer to [Querying an index](../../../../indexes/querying/query-index#session.advanced.documentquery) for examples of querying an index using a documentQuery. | ||
{NOTE/} | ||
|
||
{PANEL/} | ||
|
||
{PANEL: Custom Methods} | ||
|
||
{NOTE: } | ||
|
||
Several methods share the same functionality as their `query` counterparts. | ||
Refer to the corresponding documentation articles, marked with links starting with "[Query]" in the list below. | ||
|
||
{NOTE/} | ||
|
||
Available custom methods: | ||
|
||
- AddOrder | ||
- [query] [afterQueryExecuted](../../../../client-api/session/querying/how-to-customize-query#afterqueryexecuted) | ||
- [query] [afterStreamExecuted](../../../../client-api/session/querying/how-to-customize-query#afterstreamexecuted) | ||
- [query] [aggregateBy](../../../../client-api/session/querying/how-to-perform-a-faceted-search) | ||
- [query] [aggregateUsing](../../../../client-api/session/querying/how-to-perform-a-faceted-search) | ||
- andAlso | ||
- [query] [beforeQueryExecuted](../../../../client-api/session/querying/how-to-customize-query#beforequeryexecuted) | ||
- [boost](../../../../client-api/session/querying/text-search/boost-search-results) | ||
- closeSubclause | ||
- cmpXchg | ||
- containsAll | ||
- containsAny | ||
- [count](../../../../client-api/session/querying/how-to-count-query-results) | ||
- [countLazily](../../../../client-api/session/querying/how-to-perform-queries-lazily#lazy-count-query) | ||
- distinct | ||
- explainScores | ||
- first | ||
- firstOrDefault | ||
- fuzzy | ||
- getIndexQuery | ||
- getQueryResult | ||
- [groupBy](../../../../client-api/session/querying/how-to-perform-group-by-query) | ||
- [groupByArrayValues](../../../../client-api/session/querying/how-to-perform-group-by-query#by-array-values) | ||
- [groupByArrayContent](../../../../client-api/session/querying/how-to-perform-group-by-query#by-array-content) | ||
- [query] [Highlight](../../../../client-api/session/querying/text-search/highlight-query-results) | ||
- include | ||
- includeExplanations | ||
- intersect | ||
- invokeAfterQueryExecuted | ||
- invokeAfterStreamExecuted | ||
- [query] [lazily](../../../../client-api/session/querying/how-to-perform-queries-lazily) | ||
- [longCount](../../../../client-api/session/querying/how-to-count-query-results) | ||
- moreLikeThis | ||
- negateNext | ||
- [not](../../../../client-api/session/querying/document-query/how-to-use-not-operator) | ||
- [query] [noCaching](../../../../client-api/session/querying/how-to-customize-query#nocaching) | ||
- [query] [noTracking](../../../../client-api/session/querying/how-to-customize-query#notracking) | ||
- ofType | ||
- openSubclause | ||
- [orderBy](../../../../client-api/session/querying/sort-query-results) | ||
- [orderByDescending](../../../../client-api/session/querying/sort-query-results) | ||
- [query] [orderByDistance](../../../../client-api/session/querying/how-to-make-a-spatial-query#orderByDistance) | ||
- [query] [orderByDistanceDescending](../../../../client-api/session/querying/how-to-make-a-spatial-query#orderByDistanceDesc) | ||
- [orderByScore](../../../../client-api/session/querying/sort-query-results#order-by-score) | ||
- [orderByScoreDescending](../../../../client-api/session/querying/sort-query-results#order-by-score) | ||
- orElse | ||
- [query] [projection](../../../../client-api/session/querying/how-to-customize-query#projection) | ||
- proximity | ||
- [query] [randomOrdering](../../../../client-api/session/querying/how-to-customize-query#randomordering) | ||
- [query] [relatesToShape](../../../../client-api/session/querying/how-to-make-a-spatial-query#search-by-shape) | ||
- [search](../../../../client-api/session/querying/text-search/full-text-search) | ||
- selectFields | ||
- selectTimeSeries | ||
- single | ||
- singleOrDefault | ||
- skip | ||
- [query] [spatial](../../../../client-api/session/querying/how-to-make-a-spatial-query) | ||
- statistics | ||
- [suggestUsing](../../../../client-api/session/querying/how-to-work-with-suggestions) | ||
- take | ||
- [query] [timings](../../../../client-api/session/querying/how-to-customize-query#timings) | ||
- usingDefaultOperator | ||
- [query] [waitForNonStaleResults](../../../../client-api/session/querying/how-to-customize-query#waitfornonstaleresults) | ||
- where | ||
- whereBetween | ||
- [whereEndsWith](../../../../client-api/session/querying/text-search/ends-with-query) | ||
- whereEquals | ||
- [whereExists](../../../../client-api/session/querying/how-to-filter-by-field) | ||
- whereGreaterThan | ||
- whereGreaterThanOrEqual | ||
- whereIn | ||
- whereLessThan | ||
- whereLessThanOrEqual | ||
- [whereLucene](../../../../client-api/session/querying/document-query/how-to-use-lucene) | ||
- whereNotEquals | ||
- [whereRegex](../../../../client-api/session/querying/text-search/using-regex) | ||
- [whereStartsWith](../../../../client-api/session/querying/text-search/starts-with-query) | ||
- withinRadiusOf | ||
|
||
{PANEL/} | ||
|
||
{PANEL: Syntax} | ||
|
||
The definition for `documentQuery` is listed in the [Syntax section](../../../../client-api/session/querying/how-to-query#syntax) | ||
of the [Query Overview](../../../../client-api/session/querying/how-to-query). | ||
|
||
{PANEL/} | ||
|
||
## Related Articles | ||
|
||
### Session | ||
|
||
- [Query overview](../../../../client-api/session/querying/how-to-query) | ||
- [How to Use Lucene](../../../../client-api/session/querying/document-query/how-to-use-lucene) | ||
|
||
### Querying | ||
|
||
- [Query vs documentQuery](../../../../client-api/session/querying/document-query/query-vs-document-query) | ||
- [Projections](../../../../indexes/querying/projections) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
...ation.Pages/client-api/session/querying/how-to-count-query-results.php.markdown
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# Count Query Results | ||
|
||
--- | ||
|
||
{NOTE: } | ||
|
||
* The following options are available to **count query results**: | ||
|
||
* [`Count`](../../../client-api/session/querying/how-to-count-query-results#count) | ||
* [Get number of results from query stats](../../../client-api/session/querying/how-to-count-query-results#get-count-from-query-stats) | ||
|
||
{NOTE/} | ||
|
||
--- | ||
|
||
{PANEL: `Count`} | ||
|
||
Count query results using the `Count` method. | ||
|
||
{CODE-TABS} | ||
{CODE-TAB:php:documentQuery count_3@ClientApi\Session\Querying\CountQueryResults.php /} | ||
{CODE-TAB-BLOCK:sql:RQL} | ||
from "Orders" | ||
where ShipTo.Country == "UK" limit 0, 0 | ||
|
||
// The RQL generated will trigger query execution | ||
// however, no documents are returned (limit is set 0) | ||
{CODE-TAB-BLOCK/} | ||
{CODE-TABS/} | ||
|
||
{PANEL/} | ||
|
||
{PANEL: Get count from query stats} | ||
|
||
When executing a query, you can retrieve the query statistics that include the total number of results. | ||
Learn more in [Get Query Statistics](../../../client-api/session/querying/how-to-get-query-statistics). | ||
|
||
{PANEL/} | ||
|
||
## Related Articles | ||
|
||
### Client API | ||
|
||
- [Query overview](../../../client-api/session/querying/how-to-query) | ||
- [What is a Document Query](../../../client-api/session/querying/document-query/what-is-document-query) | ||
- [Filter by Field Presence](../../../client-api/session/querying/how-to-filter-by-field) | ||
- [Get Query Statistics](../../../client-api/session/querying/how-to-get-query-statistics) | ||
|
||
### Querying | ||
|
||
- [Filtering](../../../indexes/querying/filtering) | ||
- [RQL - Raven Query Language](../../../client-api/session/querying/what-is-rql) |
Oops, something went wrong.