Something like this should work:
.Filter<BlogItemPage>(x => x.SearchCategories().Match(somecategory))
Or actually, a better solution would be to just specify that you wish to search in the SearchCategories field:
.UnifiedSearch().For(q).UsingUnifiedWeights().InStandardFields().AndInField(x => x.SearchCategories)
You can remove your added convention and "SearchCategories" property that you added.
We are using Episerver Find search functionality for our blogs. I have a
page type (BlogItemPage) where we are displaying the category(using
EPiServer built-in category property) of the page.
I also want to search blogs on the basis of blog category. I am successfully
able to search it on basis of any query entered by the user.
In find index in the admin view of the CMS, the category are index and
stored in SearchCategories property. I have implemented the SearchCategories
method on BlogItemPage.cs class as
and I am registering it in my Initialization module as
and on my controller (FindSearchPageController.cs)
but the model.Results giving 0 hits for every category I search.
Also I want to provide both search option to user i.e. on the basis of any
search query enter by the user and if search query entered by user is
category name it should display that blog results.
Any suggestions on how can I achieve this.