lab episerver find - advanced developer scenarios

37
EPiServer Find Advanced Session Patrick van Kleef Mari Jørgensen

Upload: patrick-van-kleef

Post on 09-Jan-2017

688 views

Category:

Software


12 download

TRANSCRIPT

Page 1: Lab EPiServer Find - Advanced developer scenarios

EPiServer FindAdvanced SessionPatrick van KleefMari Jørgensen

Page 2: Lab EPiServer Find - Advanced developer scenarios

Introduction

• Macaw• EPiServer experience• EPiServer MVP• Blogs• Presentations• Forum• www.patrickvankleef.com

Patrick van Kleef

Page 3: Lab EPiServer Find - Advanced developer scenarios

Agenda

Unified search•Highlighting•Statistics

Page 4: Lab EPiServer Find - Advanced developer scenarios

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);

Page 5: Lab EPiServer Find - Advanced developer scenarios

Unified Search - Projection

UnifiedSearchHitAuthors, Excerpt, FileExtension, GeoLocation, HitTypeName, ImageUri, MetaData, OriginalObjectGetter, PublishDate, Section, Subsection, Title, TypeName, UpdateDate, Url

UnifiedSearch

Hit

Article page

CompanyUser

Page 6: Lab EPiServer Find - Advanced developer scenarios
Page 7: Lab EPiServer Find - Advanced developer scenarios

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

Page 8: Lab EPiServer Find - Advanced developer scenarios

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

Page 9: Lab EPiServer Find - Advanced developer scenarios
Page 10: Lab EPiServer Find - Advanced developer scenarios

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

Page 11: Lab EPiServer Find - Advanced developer scenarios

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)

Page 12: Lab EPiServer Find - Advanced developer scenarios

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.

Page 13: Lab EPiServer Find - Advanced developer scenarios

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

Page 14: Lab EPiServer Find - Advanced developer scenarios

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

Page 15: Lab EPiServer Find - Advanced developer scenarios

Statistics – Spellcheck

• Use .NET client API• Or Javascript

• Suggestions based on real search queries

Grouz

Group

Search

Page 16: Lab EPiServer Find - Advanced developer scenarios
Page 17: Lab EPiServer Find - Advanced developer scenarios

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

Page 18: Lab EPiServer Find - Advanced developer scenarios

Next Up: Mari

Page 19: Lab EPiServer Find - Advanced developer scenarios

About me

Mari Jørgensen

• Team leader / senior developer at GETA, in Oslo, Norway

• 12 years of EPiServer experience

• marijorg

Page 20: Lab EPiServer Find - Advanced developer scenarios

EPiServer Find- A powerful query engineMari JørgensenTeam leader & Senior Developer @Geta

Page 21: Lab EPiServer Find - Advanced developer scenarios

Beyond the search page

• More than free text search • Developer friendly• Powerful and scalable query platform

Page 22: Lab EPiServer Find - Advanced developer scenarios

• Indexing• Filtering and

caching• Facets• Multi search

Agenda

Page 23: Lab EPiServer Find - Advanced developer scenarios

Indexing

.NET Client API• EPiServer.Find.dll• Depends on JSON.NET• No EPiServer dependencies• Easy install using NuGet

Page 24: Lab EPiServer Find - Advanced developer scenarios

Indexing demo

Page 25: Lab EPiServer Find - Advanced developer scenarios

IClient

Indexing• IClient interface• Customize serialization• Attributes or by convention• Use bulks, please!

Page 26: Lab EPiServer Find - Advanced developer scenarios

Filtering demo

Page 27: Lab EPiServer Find - Advanced developer scenarios

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

Page 28: Lab EPiServer Find - Advanced developer scenarios

Facets demo

Page 29: Lab EPiServer Find - Advanced developer scenarios

Facets

Aggregated Data• Terms, Histogram, Filter, Range and

Geographical • Default size is 10• Filter vs FilterHits – know the difference!

Page 31: Lab EPiServer Find - Advanced developer scenarios

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

Page 32: Lab EPiServer Find - Advanced developer scenarios

Next Up: LAB

Page 33: Lab EPiServer Find - Advanced developer scenarios

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)

Page 34: Lab EPiServer Find - Advanced developer scenarios

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

Page 35: Lab EPiServer Find - Advanced developer scenarios

Demo and lab code on Github

https://github.com/patkleef/EPiServerFindDemo

Page 36: Lab EPiServer Find - Advanced developer scenarios

Contact information

Patrick• www.patrickvankleef.com• patkleef

Mari• world.episerver.com/

Blogs/Mari-Jorgensen/ • marijorg

Page 37: Lab EPiServer Find - Advanced developer scenarios

Thank you!