Skip to content

Commit

Permalink
Adding energy consumption and weight filters
Browse files Browse the repository at this point in the history
  • Loading branch information
goulven authored and goulven committed Dec 11, 2024
1 parent d4b80ea commit 43a2438
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ public VerticalSearchResponse verticalSearch(VerticalConfig vertical, VerticalSe


// Adding custom numeric filters
// Criteria optional
for (NumericRangeFilter filter : request.getNumericFilters()) {

if (!filter.isAllowEmptyValues()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,14 @@ protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpSer
vRequest.getNumericFilters().add(new NumericRangeFilter("price.minPrice.price", 0.0001, 500000.0, 100.0, false));
vRequest.getNumericFilters().add(new NumericRangeFilter("scores.ECOSCORE.value", 0.0001, 500000.0, 0.1, true));
vRequest.getNumericFilters().add(new NumericRangeFilter("scores.BRAND_SUSTAINABILITY.value", 0.0001, 500000.0, 0.1, true));
vRequest.getNumericFilters().add(new NumericRangeFilter("attributes.indexed.POWER_CONSUMPTION.numericValue", 0.0001, 500000.0, 0.1, true));
vRequest.getNumericFilters().add(new NumericRangeFilter("attributes.indexed.POWER_CONSUMPTION_OFF.numericValue", 0.0001, 500000.0, 0.1, true));






List<AttributeConfig> numericFilters = config.getVerticalFilters().stream()
.map(e -> config.getAttributesConfig().getAttributeConfigByKey(e))
.filter(e-> e != null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,56 @@
</th:block>



<!--
<th:block th:with="title='Evaluation ESG',
id='scores.BRAND_SUSTAINABILITY.value',
labelType='alert-success',
icon='fa-cart-plus',
label='Evaluation de performance ESG, par Sustainalytics',
min=0,
max=5,
interval=1,
includeUndefined=true,
showIncludeUndefinedButton=true,
includeUndefinedLabel='Afficher les non évalués'
">
<th:block th:insert="~{inc/vertical-filter-item-numeric.html}"></th:block>
</th:block>
-->

<th:block th:with="title='Consommation en marche',
id='attributes.indexed.POWER_CONSUMPTION.numericValue',
labelType='alert-success',
icon='fa-cart',
label='Consommation en marche (typique / max)',
min=0,
max=1000,
interval=1,
includeUndefined=true,
showIncludeUndefinedButton=true,
includeUndefinedLabel='Afficher les non évalués',
undefinedCount=${products.unknown('attributes.indexed.POWER_CONSUMPTION.numericValue')}
">
<th:block th:insert="~{inc/vertical-filter-item-numeric.html}"></th:block>
</th:block>

<th:block th:with="title='Consommation en veille',
id='attributes.indexed.POWER_CONSUMPTION_OFF.numericValue',
labelType='alert-success',
icon='fa-cart',
label='Consommation en veille (ou à l\'arrèt)',
min=0,
max=1000,
interval=1,
includeUndefined=true,
showIncludeUndefinedButton=true,
includeUndefinedLabel='Afficher les non évalués',
undefinedCount=${products.unknown('attributes.indexed.POWER_CONSUMPTION_OFF.numericValue')}
">
<th:block th:insert="~{inc/vertical-filter-item-numeric.html}"></th:block>
</th:block>


<!-- The item condition -->
Expand All @@ -42,25 +92,9 @@
</th:block>



<!--
<th:block th:with="title='Evaluation ESG',
id='scores.BRAND_SUSTAINABILITY.value',
labelType='alert-success',
icon='fa-cart-plus',
label='Evaluation de performance ESG, par Sustainalytics',
min=0,
max=5,
interval=1,
includeUndefined=true,
showIncludeUndefinedButton=true,
includeUndefinedLabel='Afficher les non évalués'
">

<th:block th:insert="~{inc/vertical-filter-item-numeric.html}"></th:block>
</th:block>
-->




<!-- The originating countries -->
<th:block th:with="id='countries',
Expand All @@ -75,20 +109,8 @@
">
<th:block th:insert="~{inc/vertical-filter-item-terms.html}"></th:block>
</th:block>
<!--
<th:block th:with="title='Consommation en marche',
id='attributes.indexed.POWER_CONSUMPTION.numericValue',
labelType='alert-success',
icon='fa-cart-energy',
label='Consommation en marche (typique / max)',
min=0,
max=500,
interval=1,
includeUndefined=true,
showIncludeUndefinedButton=true,
includeUndefinedLabel='Afficher les non évalués'
">
-->



<!-- Custom eco filters -->
<th:block th:each="filterName : ${verticalConfig.ecoFilters}">
Expand Down

0 comments on commit 43a2438

Please sign in to comment.