Skip to content

Commit

Permalink
docs: update example
Browse files Browse the repository at this point in the history
  • Loading branch information
faustoq committed Jul 19, 2024
1 parent 26ccbbf commit 0389cdc
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![Tests](https://github.com/askorama/oramacloud-client-php/actions/workflows/tests.yml/badge.svg)](https://github.com/askorama/oramacloud-client-php/actions/workflows/tests.yml)

OramaCloud PHP Client SDK
OramaCloud PHP Client SDK.

## Install

Expand All @@ -25,25 +25,33 @@ $client = new Client([
'endpoint' => '<Your Orama Cloud Endpoint>'
]);

$query = new Query('red shoes');
$query->where('price', 'gt', 99.99);
$query = (new Query('red shoes'))
->where('price', 'gt', 99.99);

$results = $client->search($query);
```

## Advanced search

```php
use OramaCloud\Client;
use OramaCloud\Client\Query;
use OramaCloud\Client\QueryParams/WhereOperator;
use OramaCloud\Client\QueryParams/SortByOrder;

$query = (new Query('red shoes', 'fulltext'))
->where('price', WhereOperator::LTE, 9.99)
->where('gender', WhereOperator::EQ, 'unisex')
->sortBy('price' SortByOrder::DESC)
->limit(5)
->offset(1);
$client = new Client([
'api_key' => '<Your Orama Cloud API Key>',
'endpoint' => '<Your Orama Cloud Endpoint>'
]);

$query = new Query();
$query->term('red shoes')
->mode('hybrid')
->where('price', WhereOperator::LTE, 9.99)
->where('gender', WhereOperator::EQ, 'unisex')
->sortBy('price' SortByOrder::DESC)
->limit(5)
->offset(1);

$results = $client->search($query);
```
Expand Down

0 comments on commit 0389cdc

Please sign in to comment.