Skip to content

Commit

Permalink
IBX-8726: IsBookmarked search criterion added (#2545)
Browse files Browse the repository at this point in the history
* IsBookmarked criterion added

* code moved to code_samples

* PHP CS Fixes

* REST API examples added

* Fixes after review

---------

Co-authored-by: julitafalcondusza <julitafalcondusza@users.noreply.github.com>
  • Loading branch information
julitafalcondusza and julitafalcondusza authored Nov 25, 2024
1 parent ed7274a commit 23fbf48
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 0 deletions.
9 changes: 9 additions & 0 deletions code_samples/search/location/isbookmarked_criterion.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php declare(strict_types=1);

use Ibexa\Contracts\Core\Repository\Values\Content\LocationQuery;
use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\Location\IsBookmarked;

$query = new LocationQuery();
$query->filter = new IsBookmarked();
/** @var \Ibexa\Contracts\Core\Repository\SearchService $searchService */
$results = $searchService->findLocations($query);
45 changes: 45 additions & 0 deletions docs/search/criteria_reference/isbookmarked_criterion.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
description: IsBookmarked Search Criterion
---

# IsBookmarked Criterion

The [`IsBookmarked` Search Criterion](../../api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-Query-Criterion-Location-IsBookmarked.html)
searches for location based on whether it's bookmarked or not.
It works with current user reference.

This Criterion is available only for location Search.

## Arguments

- `value` - bool representing whether to search for bookmarked location (default `true`) or not bookmarked location (`false`)

## Example

### PHP

``` php
[[= include_file('code_samples/search/location/isbookmarked_criterion.php', 2) =]]
```

### REST API

=== "XML"

```xml
<Query>
<Filter>
<IsBookmarkedCriterion>true</IsBookmarkedCriterion>
</Filter>
</Query>
```

=== "JSON"

```json
"Query": {
"Filter": {
"IsBookmarkedCriterion": true
}
}
```
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ Due to this storage limitation, searching content using the Country Field Type o
|[ImageMimeType](imagemimetype_criterion.md)|Image type|&#10004;|&#10004;||
|[ImageOrientation](imageorientation_criterion.md)|Image orientation|&#10004;|&#10004;||
|[ImageWidth](imagewidth_criterion.md)|Image width in pixels|&#10004;|&#10004;||
|[IsBookmarked](isbookmarked_criterion.md)|Whether a location is bookmarked or not| |&#10004; |&#10004; |
|[IsCurrencyEnabledCriterion](iscurrencyenabled_criterion.md)|Whether a specified currency is enabled in the system| | | |
|[IsFieldEmpty](isfieldempty_criterion.md)|Whether a specified Field of a content item is empty or not|&#10004; |&#10004; | |
|[IsMainLocation](ismainlocation_criterion.md)|Whether a Location is the main Location of a content item| |&#10004; |&#10004; |
Expand Down
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,7 @@ nav:
- ImageMimeType: search/criteria_reference/imagemimetype_criterion.md
- ImageOrientation: search/criteria_reference/imageorientation_criterion.md
- ImageWidth: search/criteria_reference/imagewidth_criterion.md
- IsBookmarked: search/criteria_reference/isbookmarked_criterion.md
- IsCurrencyEnabled: search/criteria_reference/iscurrencyenabled_criterion.md
- IsFieldEmpty: search/criteria_reference/isfieldempty_criterion.md
- IsMainLocation: search/criteria_reference/ismainlocation_criterion.md
Expand Down

0 comments on commit 23fbf48

Please sign in to comment.