Skip to content
Closed
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions docs/search/aggregation_reference/aggregation_reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ There are three types of aggregations:
|---|---|---|
|[Product attribute](product_attribute_aggregations.md) | Term / Range | Product attribute values |
|[ProductAvailabilityTerm](productavailabilityterm_aggregation.md) | Term | Product availability |
|[ProductStockRange](productstockrange_aggregation.md) | Range | Product stock |
|[ProductPriceRange](productpricerange_aggregation.md) | Range | Product price |
|[ProductTypeTerm](producttypeterm_aggregation.md) | Term | Product type |
|[TaxonomyEntryIdAggregation](taxonomyentryid_aggregation.md) | Term | Product category |
21 changes: 21 additions & 0 deletions docs/search/aggregation_reference/productstockrange_aggregation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# ProductStockRangeAggregation

The ProductStockRangeAggregation aggregates search results by products' numerical stock.

## Arguments

- `name` - name of the Aggregation
- `ranges` - array of Range objects that define the borders of the specific range sets

## Example

``` php
$productQuery = new ProductQuery();
$productQuery->setAggregations([
new ProductStockRangeAggregation('stock', [
new Range(null, 10),
new Range(10, 100),
new Range(100, null),
]),
]);
```
12 changes: 12 additions & 0 deletions docs/search/criteria_reference/ancestor_criterion.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,22 @@ searches for content that is an ancestor of the provided Location, including thi

## Example

### PHP

``` php
$query->query = new Criterion\Ancestor([$this->locationService->loadLocation(62)->pathString]);
```

### REST API

XML

```xml
```

JSON


## Use case

You can use the Ancestor Search Criterion to create a list of breadcrumbs leading to the Location:
Expand Down
37 changes: 35 additions & 2 deletions docs/search/criteria_reference/baseprice_criterion.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ The [`BasePrice` Search Criterion](https://github.com/ibexa/core/blob/main/src/c

## Arguments

- `value` - a `Money` object representing the price in a specific currency
- `value` - a `Money\Money` object representing the price in a specific currency
- (optional) `operator` - Operator constant (EQ, GT, GTE, LT, LTE, default EQ)

## Limitations
Expand All @@ -13,6 +13,39 @@ The `BasePrice` Criterion is not available in the Legacy Search engine.

## Example

### PHP

``` php
$query->query = new Product\Query\Criterion\BasePrice(Money::EUR(12900), BasePrice::GTE);
$query = new ProductQuery(
null,
new \Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion\BasePrice(
\Money\Money::EUR(12900),
\Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion\Operator::GTE
)
);
```

### REST

=== "XML"

```xml
<Query>
<Filter>
<BasePriceCriterion>
<Money>EUR(12900)</Money>
<Operator>gte</Operator>
</BasePriceCriterion>
</Filter>
</Query>
```

=== "JSON"

```json
"Query": {
"Filter": {
"ContentIdCriterion": [69, 72]
}
}
```
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,8 @@ The `CheckboxAttribute` Search Criterion searches for products by the value of t
## Example

``` php
$query->query = new Product\Query\Criterion\CheckboxAttribute('automatic', true);
$query = new ProductQuery(
null,
new \Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion\CheckboxAttribute('automatic', true)
);
```
7 changes: 5 additions & 2 deletions docs/search/criteria_reference/colorattribute_criterion.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@ The `ColorAttribute` Search Criterion searches for products by the value of thei
## Arguments

- `identifier` - string representing the attribute
- `value` - string representing the attribute value
- `value` - array of strings representing the attribute values

## Example

``` php
$query->query = new Product\Query\Criterion\ColorAttribute('color', '#FF0000');
$query = new ProductQuery(
null,
new \Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion\ColorAttribute('color', ['#FF0000'])
);
```
24 changes: 24 additions & 0 deletions docs/search/criteria_reference/contentid_criterion.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,30 @@ searches for content by its ID.

## Example

### PHP

``` php
$query->query = new Criterion\ContentId([62, 64]);
```

### REST

=== "XML"

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

=== "JSON"

```json
"Query": {
"Filter": {
"ContentIdCriterion": [69, 72]
}
}
```
24 changes: 24 additions & 0 deletions docs/search/criteria_reference/contenttypeid_criterion.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,30 @@ searches for content based on the ID of its Content Type.

## Example

### PHP

``` php
$query->query = new Criterion\ContentTypeId([44]);
```

### REST

=== "XML"

```xml
<Query>
<Filter>
<ContentTypeIdCriterion>44</ContentTypeIdCriterion>
</Filter>
</Query>
```

=== "JSON"

```json
"Query": {
"Filter": {
"ContentTypeIdCriterion": 44
}
}
```
24 changes: 24 additions & 0 deletions docs/search/criteria_reference/contenttypeidentifier_criterion.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,30 @@ searches for content based on the identifier of its Content Type.

## Example

### PHP

``` php
$query->query = new Criterion\ContentTypeIdentifier(['article', 'blog_post']);
```

### REST API

=== "XML"

```xml
<Query>
<Filter>
<ContentTypeIdentifierCriterion>article</ContentTypeIdentifierCriterion>
</Filter>
</Query>
```

=== "JSON"

```json
"Query": {
"Filter": {
"ContentTypeIdentifierCriterion": "article"
}
}
```
33 changes: 30 additions & 3 deletions docs/search/criteria_reference/createdat_criterion.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,38 @@ The `CreatedAt` Search Criterion searches for products based on the date when th

## Example

### PHP

``` php
$criteria = new Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion\CreatedAt(
'2022-07-11T00:00:00+02:00'
Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion\Operator::GTE,
$criteria = new \Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion\CreatedAt(
new DateTime('2023-03-01'),
\Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion\Operator::GTE,
);

$productQuery = new ProductQuery(null, $criteria);
```

### REST

=== "XML"

```xml
<Query>
<Filter>
<CreatedAtCriterion>
<created_at>12-09-2022</created_at>
</Filter>
</Query>
```

=== "JSON"

```json
"Query": {
"Filter": {
"CreatedAtCriterion": {
"created_at": "12-09-2022"
}
}
}
```
2 changes: 1 addition & 1 deletion docs/search/criteria_reference/createdatrange_criterion.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ The `CreatedAtRange` Search Criterion searches for products based on the date ra
## Example

``` php
$criteria = new Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion\CreatedAtRange(
$criteria = new \Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion\CreatedAtRange(
new \DateTimeImmutable('2020-07-10T00:00:00+00:00'),
new \DateTimeImmutable('2023-07-12T00:00:00+00:00')
);
Expand Down
10 changes: 8 additions & 2 deletions docs/search/criteria_reference/customprice_criterion.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ The `CustomPrice` Search Criterion searches for products by their custom price f

## Arguments

- `value` - a `Money` object representing the price in a specific currency
- `value` - a `Money\Money` object representing the price in a specific currency
- (optional) `operator` - Operator constant (EQ, GT, GTE, LT, LTE, default EQ)
- (optional) `customerGroup` - a `CustomerGroupInterface` object representing the customer group to show prices for.
If you do not provide a customer group, the query uses the group related to the current user.
Expand All @@ -16,5 +16,11 @@ The `CustomPrice` Criterion is not available in the Legacy Search engine.
## Example

``` php
$query->query = new Product\Query\Criterion\CustomPrice(Money::EUR(13800), BasePrice::GTE, $customerGroup);
$query = new ProductQuery(
null,
new \Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion\CustomPrice(
\Money\Money::EUR(13800),
\Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion\Operator::GTE,
$customerGroup)
);
```
36 changes: 34 additions & 2 deletions docs/search/criteria_reference/datemetadata_criterion.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ searches for content based on the date when it was created or last modified.
- `operator` - Operator constant (IN, EQ, GT, GTE, LT, LTE, BETWEEN)
- `value` - indicating the date(s) that should be matched, provided as a UNIX timestamp (or array of timestamps)

## Example
## Examples

### PHP API

``` php
$query->query = new Criterion\DateMetadata(
Expand All @@ -19,6 +21,36 @@ $query->query = new Criterion\DateMetadata(
);
```

### REST API

=== "XML"

```xml
<Query>
<Filter>
<DateMetadataCriterion>
<Target>modified</Target>
<Value>1675681020</Value>
<Operator>gte</Operator>
</DateMetadataCriterion>
</Filter>
</Query>
```

=== "JSON"

```json
"Query": {
"Filter": {
"DateMetadataCriterion": {
"Target": "modified",
"Value": 1675681020,
"Operator": "gte"
}
}
}
```

## Use case

You can use the `DateMetadata` Criterion to search for blog posts that have been created within the last week:
Expand All @@ -31,4 +63,4 @@ $query->query = new Criterion\LogicalAnd([
new Criterion\DateMetadata(Criterion\DateMetadata::CREATED, Criterion\Operator::GTE, $date),
]
);
```
```
8 changes: 7 additions & 1 deletion docs/search/criteria_reference/floatattribute_criterion.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,11 @@ The `FloatAttribute` Search Criterion searches for products by the value of thei
## Example

``` php
$query->query = new Product\Query\Criterion\FloatAttribute('length', 16.5);
$query = new ProductQuery(
null,
new \Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion\FloatAttribute(
'length',
16.5
)
);
```
8 changes: 7 additions & 1 deletion docs/search/criteria_reference/integerattribute_criterion.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,11 @@ The `IntegerAttribute` Search Criterion searches for products by the value of th
## Example

``` php
$query->query = new Product\Query\Criterion\IntegerAttribute('size', 38);
$query = new ProductQuery(
null,
new \Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion\IntegerAttribute(
'size',
38
)
);
```
2 changes: 2 additions & 0 deletions docs/search/criteria_reference/product_search_criteria.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ Search Criterion let you to filter product by specific attributes, for example:
|[IntegerAttribute](integerattribute_criterion.md)|Value of product's integer attribute|
|[SelectionAttribute](selectionattribute_criterion.md)|Value of product's selection attribute|
|[ProductAvailability](productavailability_criterion.md)|Product's availability|
|[ProductStock](productstock_criterion.md)|Product's numerical stock|
|[ProductStockRange](productstockrange_criterion.md)|Product's numerical stock|
|[ProductCategory](productcategory_criterion.md)|Product category assigned to product|
|[ProductCode](productcode_criterion.md)|Product's code|
|[ProductName](productname_criterion.md)|Product's name|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,8 @@ The `ProductAvailability` Search Criterion searches for products by their availa
## Example

``` php
$query->query = new Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion\ProductAvailability(true);
$query = new ProductQuery(
null,
new \Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion\ProductAvailability(true)
);
```
Loading