Search categories with EPiServer Find



I'm currently in a project where they use EPiServer Find and unfortunately I haven't used it before so I'm kind of lost.

At the moment you can only search for pages by Text and Title:

var findClient = Client.CreateFromConfig();

var queryObject = findClient.Search<SitePageData>()
.WildCardQuery(String.Format("{0}*", query), x => x.SearchText())
.WildCardQuery(String.Format("{0}*", query), x => x.SearchTitle())

After this code there are some filtering done aswell but that is irrelevant.

What I want to do now is to be able to get hits on the categories of the page also.

I tried something like this:

.WildCardQuery(String.Format("{0}*", query), x => x.SearchCategories()) but it want a string and not an IEnumerable. So I tried this:

.WildCardQuery(String.Format("{0}*", query), x => ConvertCategoriesToString(x.SearchCategories())). It compiles but doesn't work.

I also tried using "InField" like they do here:

but it still doesnt work with categories, only simple strings. 

I think I'm not approaching this correct at all...

Some help would be very nice :)

Jun 04, 2014 12:03

Doh, now I feel stupid. It actually worked all along... 

I had to write the entire category string in the search query to get a hit (of course). I got confused by the wild card queries for Text and Title where you dont need to write the entire title or text to get a hit (of course).

Jun 04, 2014 12:52
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.