I would like to use the Unified Search functionality of FIND to filter search results using our own custom categories and our own Published Date fields as Facets, but I cant see how this can be done - I have searched the internet for days and cant find any documentation about this.
I have used the alternative way:
var queryx = client.Search<DocumentFile>()
.TermsFacetFor(x => x.SubjectTags)
.TermsFacetFor(x => x.DocumentTags)
.OrderByDescending(x => x.DatePublished);
BUt I would ideally like to use the UnifiedSearch method.
Can you help?
You can easily index extra information by adding extension methods. Here's an example: http://world.episerver.com/Modules/Forum/Pages/Thread.aspx?id=79729
Hi, Many thanks. How would you apply this so our facets are derived from a categorylist which is a property of a page.
All the examples we have seen regarding facets always seem to reference the pageName rather than any other type.
On a second thought, I think the easiest approach in this case would be to do the following:
create facets by using the "SearchCategories" property, which is part of the ISearchContent interface(which is used by unified search).
.TermsFacetFor(x => x.SearchCategories);
On your page classes, ArticlePage, SitePageData, etc. create a property named SearchCategories. By doing this you will override what normally would be indexed, which is the standard category property.
public IEnumerable<string> SearchCategories
foreach (int category in SomeCategoryProperty)
yield return Category.GetCategoryName(category);
And then run the cms content indexing job.
That is great, many thanks. Second question, How would I get a single string such as DatePublished to come back as a Facet?
For datetime facets I would recommend using the HistogramFacetFor methodhttp://find.episerver.com/Documentation/dotnet-api-histogram-facetsThe ISearchContent interface contains a couple of DateTime methods that you could override. http://world.episerver.com/Documentation/Items/Developers-Guide/EPiServer-Find1/75/DotNET-Client-API/Searching/Unified-search/Optionally create an extension which returns a string, as referenced in my first reply, and use TermsFacetFor on that
Excellent many thanks