Skip to content

Commit d3ad9cf

Browse files
IBX-8726: IsBookmarked search criterion added (#2545)
* IsBookmarked criterion added * code moved to code_samples * PHP CS Fixes * REST API examples added * Fixes after review --------- Co-authored-by: julitafalcondusza <[email protected]>
1 parent 8c90153 commit d3ad9cf

File tree

4 files changed

+56
-0
lines changed

4 files changed

+56
-0
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php declare(strict_types=1);
2+
3+
use Ibexa\Contracts\Core\Repository\Values\Content\LocationQuery;
4+
use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\Location\IsBookmarked;
5+
6+
$query = new LocationQuery();
7+
$query->filter = new IsBookmarked();
8+
/** @var \Ibexa\Contracts\Core\Repository\SearchService $searchService */
9+
$results = $searchService->findLocations($query);
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
description: IsBookmarked Search Criterion
3+
---
4+
5+
# IsBookmarked Criterion
6+
7+
The [`IsBookmarked` Search Criterion](../../api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-Query-Criterion-Location-IsBookmarked.html)
8+
searches for location based on whether it's bookmarked or not.
9+
It works with current user reference.
10+
11+
This Criterion is available only for location Search.
12+
13+
## Arguments
14+
15+
- `value` - bool representing whether to search for bookmarked location (default `true`) or not bookmarked location (`false`)
16+
17+
## Example
18+
19+
### PHP
20+
21+
``` php
22+
[[= include_file('code_samples/search/location/isbookmarked_criterion.php', 2) =]]
23+
```
24+
25+
### REST API
26+
27+
=== "XML"
28+
29+
```xml
30+
<Query>
31+
<Filter>
32+
<IsBookmarkedCriterion>true</IsBookmarkedCriterion>
33+
</Filter>
34+
</Query>
35+
```
36+
37+
=== "JSON"
38+
39+
```json
40+
"Query": {
41+
"Filter": {
42+
"IsBookmarkedCriterion": true
43+
}
44+
}
45+
```

docs/search/criteria_reference/search_criteria_reference.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ Due to this storage limitation, searching content using the Country Field Type o
4242
|[ImageMimeType](imagemimetype_criterion.md)|Image type|&#10004;|&#10004;||
4343
|[ImageOrientation](imageorientation_criterion.md)|Image orientation|&#10004;|&#10004;||
4444
|[ImageWidth](imagewidth_criterion.md)|Image width in pixels|&#10004;|&#10004;||
45+
|[IsBookmarked](isbookmarked_criterion.md)|Whether a location is bookmarked or not| |&#10004; |&#10004; |
4546
|[IsCurrencyEnabledCriterion](iscurrencyenabled_criterion.md)|Whether a specified currency is enabled in the system| | | |
4647
|[IsFieldEmpty](isfieldempty_criterion.md)|Whether a specified Field of a content item is empty or not|&#10004; |&#10004; | |
4748
|[IsMainLocation](ismainlocation_criterion.md)|Whether a Location is the main Location of a content item| |&#10004; |&#10004; |

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,7 @@ nav:
503503
- ImageMimeType: search/criteria_reference/imagemimetype_criterion.md
504504
- ImageOrientation: search/criteria_reference/imageorientation_criterion.md
505505
- ImageWidth: search/criteria_reference/imagewidth_criterion.md
506+
- IsBookmarked: search/criteria_reference/isbookmarked_criterion.md
506507
- IsCurrencyEnabled: search/criteria_reference/iscurrencyenabled_criterion.md
507508
- IsFieldEmpty: search/criteria_reference/isfieldempty_criterion.md
508509
- IsMainLocation: search/criteria_reference/ismainlocation_criterion.md

0 commit comments

Comments
 (0)