Skip to content

Hide empty filters through configuration#117

Merged
cigolpl merged 2 commits intoitemsapi:masterfrom
mulquin:master
Jul 29, 2022
Merged

Hide empty filters through configuration#117
cigolpl merged 2 commits intoitemsapi:masterfrom
mulquin:master

Conversation

@mulquin
Copy link
Contributor

@mulquin mulquin commented Jul 29, 2022

This implements the second idea in #39. This PR adds the hide_zero_doc_count configuration value on aggregations that if set to true will exclude filters with 0 results.

Copy link
Member

@cigolpl cigolpl left a comment

Choose a reason for hiding this comment

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

Overall looks great. One question regarding this arg

src/helpers.js Outdated
selected: filters.indexOf(v2[0]) !== -1
};
})
.compact(this)
Copy link
Member

Choose a reason for hiding this comment

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

Is this argument in compact necessary here ? The data is flowing form one function to next thanks to chain.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Absolutely right, will update shortly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@cigolpl Updated

@cigolpl cigolpl merged commit 688fc31 into itemsapi:master Jul 29, 2022
@cigolpl
Copy link
Member

cigolpl commented Jul 29, 2022

Thanks! This can be get by new version itemsjs@2.1.20

@SergeyRe
Copy link
Contributor

thanks for adding this feature
the only thing prevents using it :
i show selected facet value always (even it has zero doc_count)
reasons: to show user his choice made and to give possibility to cancel it
I think it will be great to have option to hide all zero doc_count facet values but selected

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants