matteodem / meteor-easy-search

Easy-to-use search for Meteor with Blaze Components
MIT License
438 stars 68 forks source link

facets that only show results that valid values #650

Closed meecect closed 2 years ago

meecect commented 4 years ago

I have basic faceting features working, but was wondering, is there a common way to only show facet options for values that will narrow the search?

I have a collection called 'articles' that has a field for groupId which relates to a different collection for groups.

If I build an index on articles and show them in a table, I can also show a list of facets on the side that pulls from the groups collection, to allow filtering articles by group, but I'd rather not show ALL groups as facets as I have a lot of groups. I'd rather just show groups that have articles.

Another example would be if you combine the facets with a search input. If you begin typing in the search input, the index results change, so the number of rows in my table changes, so I would like the facets displayed to change at the same time. In that way, the facets that are displayed are only the ones that are relevant to your current search.

Any ideas on how I could implement this?

matteodem commented 2 years ago

With the component methods and custom components that should definitely be possible. Please consult the docs.