Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/search/criteria_reference/contentid_criterion.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ $query->query = new Criterion\ContentId([62, 64]);
```xml
<Query>
<Filter>
<ContentIdCriterion>[69, 72]</ContentIdCriterion>
<ContentIdCriterion>1,52</ContentIdCriterion>
</Filter>
</Query>
```
Expand All @@ -35,7 +35,7 @@ $query->query = new Criterion\ContentId([62, 64]);
```json
"Query": {
"Filter": {
"ContentIdCriterion": [69, 72]
"ContentIdCriterion": "1,52"
}
}
```
2 changes: 1 addition & 1 deletion docs/search/criteria_reference/contentname_criterion.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ $query->query = new Criterion\ContentName('*phone');
"ContentNameCriterion": "*phone"
}
}
```
```
24 changes: 1 addition & 23 deletions docs/search/criteria_reference/contenttypegroupid_criterion.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ $query->query = new Criterion\ContentTypeGroupId([1, 2]);
```xml
<Query>
<Filter>
<ContentTypeGroupIdCriterion>[1, 2]</ContentTypeGroupIdCriterion>
<ContentTypeGroupIdCriterion>1</ContentTypeGroupIdCriterion>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't comment on line 38, asking to be sure - arrays work for JSON requests, but do not work for XML?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/ibexa/rest/blob/v5.0.2/src/lib/Server/Input/Parser/Criterion/ContentTypeGroupId.php#L31 is creating the criterion with raw data, the criterion constructor expect integer or array.

And, yes:
In JSON, arrays exist; In XML they doesn't exist.

So, the following JSON works:

{
    "ViewInput": {
        "identifier": "test",
        "Query": {
            "Filter": {
                "ContentTypeGroupIdCriterion": [1, 2]
            }
        }
    }
}

While the following XML fails:

<?xml version="1.0" encoding="UTF-8"?>
<ViewInput>
    <identifier>test</identifier>
    <Query>
        <Filter>
            <ContentTypeGroupIdCriterion>[1, 2]</ContentTypeGroupIdCriterion>
        </Filter>
    </Query>
</ViewInput>

The error is "ContentTypeGroupId::__construct(): Argument #1 ($value) must be of type array|int, string given".

The following works because the node value is seen as an integer somewhen betwen XML parsing and PHP type juggling:

<?xml version="1.0" encoding="UTF-8"?>
<ViewInput>
    <identifier>test</identifier>
    <Query>
        <Filter>
            <ContentTypeGroupIdCriterion>1</ContentTypeGroupIdCriterion>
        </Filter>
    </Query>
</ViewInput>

But there is no way to write an anonymous array in XML, you need a named tag node. That's why the ContentIdCriterion transform the data before passing it (actually splitting string into array using coma as separator).

</Filter>
</Query>
```
Expand Down Expand Up @@ -55,25 +55,3 @@ You can use the `ContentTypeGroupId` Criterion to query all Media content items
}
}
```

### REST API

=== "XML"

```xml
<Query>
<Filter>
<ContentIdCriterion>[69, 72]</ContentIdCriterion>
</Filter>
</Query>
```

=== "JSON"

```json
"Query": {
"Filter": {
"ContentIdCriterion": [69, 72]
}
}
```
1 change: 0 additions & 1 deletion docs/search/criteria_reference/datemetadata_criterion.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ $query->query = new Criterion\DateMetadata(
}
```


## Use case

You can use the `DateMetadata` Criterion to search for blog posts that have been created within the last week:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ The [`DateTimeAttributeRange Search Criterion`](/api/php_api/php_api_reference/c

The following example lists all products for which the `event_date` attribute has value greater than 2025-01-01.


``` php
[[= include_file('code_samples/back_office/search/src/Query/DateTimeAttributeRangeQuery.php') =]]
```
1 change: 0 additions & 1 deletion docs/search/criteria_reference/field_criterion.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ Querying for a collection with the `EQ` operator returns result only when the wh

The `Field` Criterion isn't available in [Repository filtering](search_api.md#repository-filtering).


## Example

### PHP
Expand Down
2 changes: 0 additions & 2 deletions docs/search/criteria_reference/fulltext_criterion.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
description: FullText Search Criterion
---


# FullText Criterion

The [`FullText` Search Criterion](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-Query-Criterion-FullText.html) searches for content based on the full text content of its fields.
Expand All @@ -27,7 +26,6 @@ The [`FullText` Search Criterion](/api/php_api/php_api_reference/classes/Ibexa-C

\*\*\* Asteriks may only be located at the beginning or end of a query.


## Limitations

When using the Legacy search engine, a full text query performs an OR query by default, and
Expand Down
2 changes: 1 addition & 1 deletion docs/search/criteria_reference/image_criterion.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,4 @@ $query->query = new Criterion\Image('image', $imageCriteriaData);
}
}
}
```
```
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,4 @@ $query->query = new Criterion\Dimensions('image', $imageCriteriaData);
}
}
}
```
```
2 changes: 1 addition & 1 deletion docs/search/criteria_reference/imagefilesize_criterion.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@ $query->query = new Criterion\FileSize('image', 0, 1.5);
}
}
}
```
```
2 changes: 1 addition & 1 deletion docs/search/criteria_reference/imagemimetype_criterion.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,4 @@ $query->query = new Criterion\MimeType('image', $mimeTypes);
}
}
}
```
```
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,4 @@ $query->query = new Criterion\Orientation('image', $orientations);
}
}
}
```
```
20 changes: 20 additions & 0 deletions docs/search/criteria_reference/iscontainer_criterion.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---

Check warning on line 1 in docs/search/criteria_reference/iscontainer_criterion.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/search/criteria_reference/iscontainer_criterion.md#L1

[Ibexa.ReadingLevel] The grade level is 11.57. Aim for 8th grade or lower by using shorter sentences and words.
Raw output
{"message": "[Ibexa.ReadingLevel] The grade level is 11.57. Aim for 8th grade or lower by using shorter sentences and words.", "location": {"path": "docs/search/criteria_reference/iscontainer_criterion.md", "range": {"start": {"line": 1, "column": 1}}}, "severity": "WARNING"}
description: IsContainer Search Criterion
---

# IsContainer Criterion
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mnocon I let Copilot do it in 617fe41

Hi,
Can you, please, add the IsContainer criterion to the search_criteria_reference.md table? Mark it available for "Content Search", "Location Search" and "Filtering". Have this new row column widths equal to the other rows of the table.


The [`IsContainer` Search Criterion](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-Query-Criterion-IsContainer.html) searches for content items based on whether they are containers (i.e., can contain other content items).

Check failure on line 7 in docs/search/criteria_reference/iscontainer_criterion.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/search/criteria_reference/iscontainer_criterion.md#L7

[Ibexa.VariablesGlobal] Use global variable '[[= product_name_base =]]' instead of 'Ibexa'
Raw output
{"message": "[Ibexa.VariablesGlobal] Use global variable '[[= product_name_base =]]' instead of 'Ibexa'", "location": {"path": "docs/search/criteria_reference/iscontainer_criterion.md", "range": {"start": {"line": 7, "column": 77}}}, "severity": "ERROR"}

## Arguments

- `value` – boolean (optional, default: `true`). If `true`, searches for content that is a container. If `false`, searches for content that is not a container.

Check failure on line 11 in docs/search/criteria_reference/iscontainer_criterion.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/search/criteria_reference/iscontainer_criterion.md#L11

[Ibexa.Lists] Do not put fullstops at the end of bullets
Raw output
{"message": "[Ibexa.Lists] Do not put fullstops at the end of bullets", "location": {"path": "docs/search/criteria_reference/iscontainer_criterion.md", "range": {"start": {"line": 11, "column": 48}}}, "severity": "ERROR"}

## Example

### PHP

```php
$query->query = new Criterion\IsContainer(); // Finds containers
$query->query = new Criterion\IsContainer(false); // Finds non-containers
```
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ The `ParentLocationRemoteId` Search Criterion searches for content based on the

- `value` - int(s) representing the parent location remote IDs


### REST API

=== "XML"
Expand Down
2 changes: 0 additions & 2 deletions docs/search/criteria_reference/productstock_criterion.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,3 @@ $productQuery = new ProductQuery(
new Criterion\ProductStock(50, '>=')
);
```


2 changes: 0 additions & 2 deletions docs/search/criteria_reference/productstockrange_criterion.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,3 @@ $productQuery = new ProductQuery(
new Criterion\ProductStockRange(10, 120)
);
```


2 changes: 1 addition & 1 deletion docs/search/criteria_reference/visibility_criterion.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ $query->query = new Criterion\Visibility(Criterion\Visibility::HIDDEN);
```json
"Query": {
"Filter": {
"ContentIdCriterion": "HIDDEN"
"VisibilityCriterion": "HIDDEN"
}
}
```
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,7 @@ nav:
- ImageOrientation: search/criteria_reference/imageorientation_criterion.md
- ImageWidth: search/criteria_reference/imagewidth_criterion.md
- IsBookmarked: search/criteria_reference/isbookmarked_criterion.md
- IsContainer: search/criteria_reference/iscontainer_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
Loading