Skip to content

Commit

Permalink
Merge pull request #226 from romainruaud/fix_advanced_search
Browse files Browse the repository at this point in the history
Fixing application of range query and its usage in advanced search.
  • Loading branch information
afoucret authored Nov 30, 2016
2 parents 50702f7 + 05cbec5 commit 13bbbb6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public function addFieldsToFilter($fields)
foreach ($fields as $fieldByType) {
foreach ($fieldByType as $attributeId => $condition) {
$attributeCode = $this->getEntity()->getAttribute($attributeId)->getAttributeCode();
$condition = array_filter($condition, 'strlen');
$this->addFieldToFilter($attributeCode, $condition);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ private function prepareFieldCondition(FieldInterface $field, $condition)
$queryType = QueryInterface::TYPE_TERMS;
$condition = $this->prepareCondition($condition);

if (count(array_intersect(['gt', 'gte', 'lt', 'lte'], array_keys($condition))) > 1) {
if (count(array_intersect(['gt', 'gte', 'lt', 'lte'], array_keys($condition))) >= 1) {
$queryType = QueryInterface::TYPE_RANGE;
$condition = ['bounds' => $condition];
}
Expand Down

0 comments on commit 13bbbb6

Please sign in to comment.