When attempting to pass a filter on a custom text attribute for the products query, no results are returned. In development mode (without compile di, an exception is thrown).
Preconditions
Magento Version : 2.4.8
ElasticSuite Version : 2.11.15.1
Environment : Both
Third party modules : None related
Steps to reproduce
- Create a custom text attribute, and make it filterable in search.
- Assign different values to products for the attribute
- Attempt to filter by the attribute - e.g.
products(
filter: {
my_attribute: {
match: "some value"
}
}
Expected result
- Products matching the filter value are returned
Actual result
- In production mode, with compiled di, no results are returned
- In developer mode, an exception is thrown:
{
"errors": [
{
"message": "Internal server error",
"locations": [
{
"line": 2,
"column": 3
}
],
"path": [
"products"
],
"extensions": {
"debugMessage": "Missing required argument $values of Smile\\ElasticsuiteCore\\Search\\Request\\Query\\Terms."
}
}
],
"data": {
"products": null
}
}
Additional Information
This appears to be the same (or very similar to) #2430
I'm not sure, but I believe that the issue is with these lines:
|
if ($condition['field'] === null || isset($condition['queryText'])) { |
|
$analyzer = $field->getDefaultSearchAnalyzer(); |
|
$property = $field->getMappingProperty($analyzer); |
|
if ($property) { |
|
$condition['field'] = $property; |
|
|
|
if (isset($condition['queryText'])) { |
|
$queryType = QueryInterface::TYPE_MATCH; |
|
$condition['minimumShouldMatch'] = '100%'; |
|
} |
|
} |
|
} |
If getMappingProperty returns null, then the check for $condition['queryText'] never happens. It would make sense to me for that if statement to be outside of the check for $property:
if ($condition['field'] === null || isset($condition['queryText'])) {
$analyzer = $field->getDefaultSearchAnalyzer();
$property = $field->getMappingProperty($analyzer);
if ($property) {
$condition['field'] = $property;
}
if (isset($condition['queryText'])) {
$queryType = QueryInterface::TYPE_MATCH;
$condition['minimumShouldMatch'] = '100%';
}
}
When I tried this locally, it seemed to work ok, but I'm not sure if there's a better way to fix the issue (e.g. something within the getMappingProperty function.
When attempting to pass a filter on a custom text attribute for the
productsquery, no results are returned. In development mode (without compile di, an exception is thrown).Preconditions
Magento Version : 2.4.8
ElasticSuite Version : 2.11.15.1
Environment : Both
Third party modules : None related
Steps to reproduce
Expected result
Actual result
Additional Information
This appears to be the same (or very similar to) #2430
I'm not sure, but I believe that the issue is with these lines:
elasticsuite/src/module-elasticsuite-core/Search/Request/Query/Filter/QueryBuilder.php
Lines 137 to 148 in 228d3cd
If
getMappingPropertyreturns null, then the check for$condition['queryText']never happens. It would make sense to me for that if statement to be outside of the check for$property:When I tried this locally, it seemed to work ok, but I'm not sure if there's a better way to fix the issue (e.g. something within the
getMappingPropertyfunction.