Download - EpiServer find Macaw
EPiServer
Findwww.patrickvankleef.com
2 patrickvankleef.com
Table Of Content
01
Index
02
Search
03
Filters
04 Facets
06
Statistics
What we’ll learn in this presentation
Table of contents
07
Exercises
08
Influence search results
3 patrickvankleef.com
02
01
EPiServer Find
EPiServer Find
030
405
06
Elastic SearchEPiServer Find is build on top of Elastic Search.
FacetsFacets are a way to aggregate data for all documents in an index or documents that match a certain search query or set of filtering criterias.
EPiServer Find UIManage your index, statistics and influence search results.
SearchingUsing different kind of searching types.
Geo searchThe service supports indexing geographical coordinates and later searching for them in a number of ways.
StatisticsUse statistics to improve the search functionality on the website.
4 patrickvankleef.com Unified search
Demo ApplicationsDemo website
• Indexing• Search• Statistics• https://github.com/patkleef/EPiServerFindDemo
Demo console application
• Filters• Facets
5 patrickvankleef.com
Indexing
Indexing
Indexing
6 patrickvankleef.com
Indexing
Indexing
Pages and blocks Sample
Custom objects
Use the Index method when you would like to index custom objects. Bulk index is supported!
_client.Index(obj);Pages and blocks are automatically indexed by EPiServer. This includes when a page or block is created, updated and deleted.
_client.Index(list);
_client.Delete<Company>(“6b4b3f7f-d086-4176-bb0b-e56eba210790”);
8 patrickvankleef.com
Search
Search
Search
9 patrickvankleef.com
Typed Search
Typed search
Searching on a specific type Sample
_client.Search<ArticlePage>().For(query) .GetContentResult();
GetContentResult
Use the method GetContentResult when you search for IContent types. Only the ContentReference is returned in the JSON.
GetResult
Use the GetResult method when searching on custom types. The whole object is serialized and returned by Find as JSON.
_client.Search<Company>().For(query) .GetResult();
10 patrickvankleef.com
Unified Search
Unified search
Searching on multiple types Sample
_client.UnifiedSearchFor(query) .GetResult(hitSpecification);
ISearchContent
IUnifiedSearchRegistry
Add types that should be included when searching for ISearchContent.Customize the default projection.
_client.Conventions.UnifiedSearchRegistry .Add<Company>();
_client.Conventions.UnifiedSearchRegistry .ForInstanceOf<User>() .ProjectTitleFrom(x => x.Name);
SearchText, SearchTitle, SearchTypeName, SearchUpdateDate, etc.Implement this interface or add a property or extension method to your type with the same name as on of the below properties.
Returns a collection of UnifiedSearchHit.
11 patrickvankleef.com
UnifiedSearchHit
Article page
Company
User
Unified Search - Projection • Authors
• Excerpt• FileExtension• GeoLocation• HitTypeName• ImageUri• MetaData• OriginalObjectGetter• PublishDate• Section• Subsection• Title• TypeName• UpdateDate• Url
UnifiedSearchHit
Unified search
12 patrickvankleef.com Unified search
Unified Search
Unified search = Typed search
public static ITypeSearch<ISearchContent> UnifiedSearch(this IClient client){
return client.UnifiedSearch(client.ResolveSupportedLanguageBasedOnPreferredCulture());}
14 patrickvankleef.com
Filters
Filters
Filters & Facets
15 patrickvankleef.com
Filters
Filters
Filters for different data types Sample
Similar to Where LINQ
Boolean, Complex objects, DateTime, Enum, Numerical, Strings _client.Search<Hotel>()
.Filter(h => h.PriceUSD.InRange(100, 200));
_client.Search<Hotel>() . Filter(h => h.Title.Match("Hotel"));Extension methods
Match(), MatchCaseInsensitive(), Prefix(), AnyWordBeginsWith(), LessThan(), GreaterThan(), InRange(), etc.
17 patrickvankleef.com
Statistics
Statistics
Statistics
18 patrickvankleef.com Statistics
Statistics in EPiServer Find
January February March April May June July Augustus
View the most frequent search queries 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 search queries
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 search queries without
relevant hits by last 24 hours, week, month or year. The number of click-through rate per search query is shown.
Searches without relevant hits
19 patrickvankleef.com
Statistics - Tracking
Statistics
StatisticsTrack() method
Sample
_client.UnifiedSearchFor(query).StatisticsTrack().GetResult(hitSpecification);
@Html.RequiredClientResources(RenderingTags.Footer)With the Tracking method search queries
submitted and clicking behavior by the visitor can be stored. This method will enable the statistics in the EPiServer Find interface.
Track query and hits
When using unified search the query and hits are automatically tracked when of course using the Tracking method.
/en/articles/schools-to-offer-human-rights-lessons/?
_t_id=bitl0wz5nqqzc60rzbvsxw==&_t_q=group&_t_tags=language:en,siteid:1ef1416b-
a33d-4b98-8172-30122edc3252&_t_ip=::1&
_t_hit.id=site_models_pages_articlepage/_c261fdb3-e611-42e7-ae39-d1f2a6904d97_en&
_t_hit.pos=4
Custom tracking
Create URL with querystrings
20 patrickvankleef.com
02
01
Statistics
Statistics - Functionality
03
AutocompleteGet search queries from previous visitors. Search queries can also be added in the EPiServer Find interface.
Did you mean SpellcheckUse the spellcheck functionality to give suggestions based on current search query.
Use the did you mean functionality to help users find relevant search queries based on current search query.
21
Statistics - Autocomplete
Statistics
Gr
GroupsGroGrouGroup
Search
Use .NET Client API
Use the .NET client API for receiving results._client.Statistics().GetAutocomplete(query);
Use Javascript
It’s also possible to use Javascript to get results./find_v2/_autocomplete?prefix=' + query + '&size=5
Configure in EPiServer Find UI
Use the EPiServer Find UI to insert possible search phrases.
Added in UI
patrickvankleef.com
22 patrickvankleef.com
Statistics – Did you mean
Statistics
Group
CollectionCompany
Search
Use .NET Client API
Use the .NET client API for receiving results._client.Statistics().GetDidYouMean(query);
Use Javascript
It’s also possible to use Javascript to get results./find_v2/_didyoumean?prefix=' + query + '&size=5
Configure in EPiServer Find UI
Configure related queries in the CMS. Pair a phrase with possible suggestions.
Added in UI
23 patrickvankleef.com
Statistics – Spellcheck
Statistics
Grouz
Group
Search
Use .NET Client API
Use the .NET client API for receiving results._client.Statistics().GetSpellcheck(query);
Use Javascript
It’s also possible to use Javascript to get results./find_v2/_spellcheck?prefix=' + query + '&size=5
25 patrickvankleef.com
Exercises
Exercises
Exercises
26 patrickvankleef.com
Exercises
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 either 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)
27 patrickvankleef.com
Exercises
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
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 hotels
7. Basic text search, query entered by user, in fields Name and Description
28 patrickvankleef.com
Exercises
Exercises
Solution: N:\EPiServer\Lab\Lab.zip (Projects share)