lab episerver find - advanced developer scenarios
TRANSCRIPT
EPiServer FindAdvanced SessionPatrick van KleefMari Jørgensen
Introduction
• Macaw• EPiServer experience• EPiServer MVP• Blogs• Presentations• Forum• www.patrickvankleef.com
Patrick van Kleef
Agenda
Unified search•Highlighting•Statistics
Unified Search
• Search on different types• Returns collection of UnifiedSearchHit
• ISearchContent• SearchText,
SearchTitle,SearchUpdateDate• Define properties or extension
methods with the same name
• IUnifiedSearchRegistry• Add types• Customize projections
Sample_client.UnifiedSearchFor(query)
.GetResult(hitSpecification);
_client.Conventions.UnifiedSearchRegistry.Add<Company>();
_client.Conventions.UnifiedSearchRegistry.ForInstanceOf<User>().ProjectTitleFrom(x =>
x.Name);
Unified Search - Projection
UnifiedSearchHitAuthors, Excerpt, FileExtension, GeoLocation, HitTypeName, ImageUri, MetaData, OriginalObjectGetter, PublishDate, Section, Subsection, Title, TypeName, UpdateDate, Url
UnifiedSearch
Hit
Article page
CompanyUser
Highlighting
Search for ‘to’
impossible to keep up with it all. But, with times constantly changing, we have to do our best to keep up ... that everyone should know more about is FTAs, free to air satellite receivers and files. An FTA receiver
Highlighting
01
Number of fragmentsConfigure the number of fragments that should be returned. Default value of this property is 2.
02
Fragment sizeThe length of the fragment can be set with this property. The default value is 100.
03
ConcatenationChoose how to seperate the fragments from each other. Default three dots are used to seperate fragments.0
4Post tag
Highlighted words are surrounded with HTML tags. Default value is a </em> tag.
05
Pre tag
Highlighted words are surrounded with HTML tags. Default value is a <em> tag.
impossible to keep up with it all. But, with times constantly changing, we have to do our best to keep up ... that everyone should know more about is FTAs, free to air satellite receivers and files. An FTA receiver
Statistics
January February March April May June July August
View the most frequent searches by last 24 hours, week, month or year in a visual. This statistic will also show a ranking of most search queries.
Most frequent searches
View the searches without hits by last 24 hours, week, month or year in a visual. This statistic will also show a ranking of most search queries without hits.
Searches without hits
View the searches without relevant hits by last 24 hours, week, month or year. The number of click-through rate per search query is show.
Searches without relevant hits
Statistics - Tracking
• Track search queries and click behavior
• Enable tracking• Use the StatisticsTrack
method• Call the
RequiredClientResources method on the layout view
• Custom tracking
Sample_client.UnifiedSearchFor(query)
.StatisticsTrack()
.GetResult(hitSpecification);
Html.RequiredClientResources(RenderingTags.Footer)
Statistics - Functionality
01
Autocomplete
02
Did you mean
03
Spellcheck
Get search queries from previous visitors. Queries can also be added in the EPiServer Find interface.
Use the did you mean functionality to help users find relevant content based on current search query.
Use the spellcheck functionality to give suggestions based on current search query.
Statistics – Autocomplete
• Use .NET client API• Or Javascript
• Configure in EPiServer Find UI
• Add items
• Suggestions based on real search queries
Gr
GroupsGroup
Search
Added in UI
Statistics – Did you mean
• Use .NET client API• Or Javascript
• Configure in EPiServer Find UI
• Add items
• Suggestions based on real search queries
Group
CollectionCompany
SearchAdded in
UI
Statistics – Spellcheck
• Use .NET client API• Or Javascript
• Suggestions based on real search queries
Grouz
Group
Search
Hotel demo site
Allan Thraen: “Want to try out EPiServer Find? Here is an easy way, and fun challenge!”• hotelfinder-
episerver.azurewebsites.net• github.com/patkleef/HotelFinderSite
• Typed search• Filters• Facets• Geo search
Next Up: Mari
About me
Mari Jørgensen
• Team leader / senior developer at GETA, in Oslo, Norway
• 12 years of EPiServer experience
• marijorg
EPiServer Find- A powerful query engineMari JørgensenTeam leader & Senior Developer @Geta
Beyond the search page
• More than free text search • Developer friendly• Powerful and scalable query platform
• Indexing• Filtering and
caching• Facets• Multi search
Agenda
Indexing
.NET Client API• EPiServer.Find.dll• Depends on JSON.NET• No EPiServer dependencies• Easy install using NuGet
Indexing demo
IClient
Indexing• IClient interface• Customize serialization• Attributes or by convention• Use bulks, please!
Filtering demo
Filtering
Fast and flexible• Similar to Where in LINQ• Use BuildFilter to create complex filters based on
user input• Know your caching• Project to limit data traffic
Facets demo
Facets
Aggregated Data• Terms, Histogram, Filter, Range and
Geographical • Default size is 10• Filter vs FilterHits – know the difference!
Multi search
Multi search• Multiple queries, ONE request• http
://geta.no/blogg/building-an-advanced-search-page-using-episerver-find/
Find greatness with Find
Key points to remember• Scalable, flexible and powerful – be
creative• Always cache*• Project if you can
*) The query is cached, so be smart when filtering on DateTime
Next Up: LAB
LAB Exercises
1. Filter on price get all hotels that have price between 100 and 200
2. Filter on rating/review find all hotels that have a star rating of either 4 or 5, OR review rate of 9 or 10 with more than 50 reviews
3. Filter on location get all hotels within 5 km of the cosmopolitan hotel, order by distance from cosmopolitan hotel (closest first)
LAB Exercises
4. Advanced filtering Show hotels with more than 2 stars within 10 km of the cosmopolitan hotel that offer room service, have air condition and have chain specified by user input* (*using Console.ReadLine())
5. Range facets Create range facets for price ranges 20-50, 51-100 and 101-150 USD
6. Facet for Country List name of all countries that have hotels7. Basic text search, query entered by user, in fields Name and
Description
Demo and lab code on Github
https://github.com/patkleef/EPiServerFindDemo
Contact information
Patrick• www.patrickvankleef.com• patkleef
Mari• world.episerver.com/
Blogs/Mari-Jorgensen/ • marijorg
Thank you!