Epinova / Epinova.Elasticsearch

A search-plugin for Episerver CMS and Commerce
MIT License
29 stars 20 forks source link

Need a way to get all objects that fit one- or more of selected categories #136

Closed Marcus842 closed 2 years ago

Marcus842 commented 2 years ago

Hi,

I have a search-page where I want the user to be able to filter the result based on selected categories

If I have some categories eg. "A", "B", "C", "D" and the user selects "A" and "C". I want to displays all pages that belong to "A" or "C" or "A" and "C". So a page that that has "A" and "B" would also be valid.

All pages has a category property that looks like this.

    [Editable(true)]
    [Display(Name = "Category propertylist", GroupName = SystemTabNames.Content, Order = 470)]
    public virtual IList<string> CategoryList { get; set; }

I have looked at https://github.com/Epinova/Epinova.Elasticsearch But wasn't able to find a example that covers my case.

How can I accomplish this?

otanum commented 2 years ago

Make sure CategoryList is indexed correctly with the index inspector. Should be an array of strings in the Json. Then something like https://github.com/Epinova/Epinova.Elasticsearch#advanced-filtering should do the trick.