Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more

Episerver FIND Unified Search Custom Categories

Vote:
 

Hi,

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>()
                .For(Query)
                .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?

Jon

#79813
Jan 08, 2014 9:49
Vote:
 

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

#79815
Jan 08, 2014 10:08
Vote:
 

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.

Thanks again,

Jon

#79820
Jan 08, 2014 10:51
Vote:
 

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
        {
            get
            {
                foreach (int category in SomeCategoryProperty)
                {
                    yield return Category.GetCategoryName(category);
                }
            }
        }

 And then run the cms content indexing job.

  

 

#79830
Jan 08, 2014 11:53
Vote:
 

Hi,

That is great, many thanks. Second question, How would I get a single string such as DatePublished to come back as a Facet?

Jon

#79832
Jan 08, 2014 12:03
Vote:
 

For datetime facets I would recommend using the HistogramFacetFor method
http://find.episerver.com/Documentation/dotnet-api-histogram-facets

The 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

#79835
Jan 08, 2014 12:18
Vote:
 

Excellent many thanks

#79836
Jan 08, 2014 12:19
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.