Zoeken met Sitecore 7 Egbert Wietses pionect.nl.

Slides:



Advertisements
Similar presentations
The Microsoft Technical Roadshow 2007 Language Enhancements and LINQ Daniel Moth Developer & Platform Group Microsoft Ltd
Advertisements

Solr Facets in Alfresco 4
Ofir Aspis 1/2010 VS 2010 Targets High Level - IDE New Features VS 2010 As Editor and Platform Demo Editor features Extending.
LINQ to objects. Datenmodell Zugriffsklasse Einfache Abfrage IEnumerable booksList = SampleDataAccess.DBooks.Select(b => b); Select(...) Book => object.
LINQ (Language Integrated Query)
@ScotHillier Web Parts Workflows Pages Libraries App Parts SharePoint-Hosted Apps Provider-Hosted Apps.
Sitecore7 Basics Lets see Basics of Sitecore7!. Agenda Whats new? System requirements Whats improved? Assemblies Updated Knife tools Demo Q & A.
2 C# 1.0 C# 2.0 C# 3.0 Komponensek felügyelt környezetben • Property, delegate, event Típusbiztosabb, hatékonyabb nyelv • Generikus típusok, yield return.
Deep Dive into LINQ Eran Sharabi.NET Development Team Leader JohnBryce Training
LINQ and Collections An introduction to LINQ and Collections.
Extension Methods, Anonymous Types LINQ Query Keywords, Lambda Expressions Svetlin Nakov Telerik Corporation
C# and LINQ Yuan Yu Microsoft Research Silicon Valley.
Introduction to MVC Action Methods, Edit View, and a Search Feature NTPCUG Dr. Tom Perkins.
SharePoint User Group Chicago: 1/24/2013 SharePoint 2013 Search Overview.
© Logica All rights reserved ADO vNext LINQ LINQ to SQL Entity Framework Freek Leemhuis
Part 03 – Sorting, Paging, and Grouping Entity Framework NTPCUG Tom Perkins.
.NET Reflector 5.0 Lutz Roeder December Overview C# 3.0: LINQ query expressions, Lambda expressions Code URL: code://mscorlib/System.Object Assembly.
Damien Guard (BSc, MBCS) Guernsey Software Developer Forum Language Integrated Query:
Copyright © Sequence Collective Ltd 2014 Content Search Using SOLR Copyright © Sequence Collective Ltd 2014 By: Dr. Ehab ElGindy Technical Team Lead Implementing.
2.3 Cool features in C# academy.zariba.com 1. Lecture Content 1.Extension Methods 2.Anonymous Types 3.Delegates 4.Action and Func 5.Events 6.Lambda Expressions.
XML files (with LINQ). Introduction to LINQ ( Language Integrated Query ) C#’s new LINQ capabilities allow you to write query expressions that retrieve.
IManage – New Table Option For better sorting, filtering and sorting.
LINQ Programming in C# LINQ CSE Prof. Roger Crawfis.
 Introduction  What is LINQ  Syntax  How to Query  Example Program.
LINQ, An IntroLINQ, An Intro Florin−Tudor Cristea, Microsoft Student Partner.
Elasticsearch in Dashboard Data Management Applications David Tuckett IT/SDC 30 August 2013 (Appendix 11 November 2013)
CHARLES UNIVERSITY IN PRAGUE faculty of mathematics and physics Advanced.NET Programming I 11 th Lecture Pavel Ježek
Getting familiar with LINQ to Objects Florin−Tudor Cristea, Microsoft Student Partner.
LINQ TO XML Mike Taulty Developer & Platform Group Microsoft UK
Copyright OpenHelix. No use or reproduction without express written consent1.
Extension Methods, Anonymous Types LINQ Query Keywords, Lambda Expressions Based on material from Telerik Corporation.
XQL, OQL and SQL Xia Tang Sixin Qian Shijun Shen Feb 18, 2000.
The.NET Language Integrated Query Project Anders Hejlsberg TLN306 Technical Fellow Microsoft Corporation.
Neal Stublen How does XMLReader work?  XmlReader.Read() Advances to next node XmlReader properties access node name, value, attributes,
 Language Integrated Query  Make query a part of the language  Component of.NET Framework 3.5  Shipped with Visual Studio 2008.
XP New Perspectives on The Internet, Sixth Edition— Comprehensive Tutorial 3 1 Searching the Web Using Search Engines and Directories Effectively Tutorial.
The Internet 8th Edition Tutorial 4 Searching the Web.
 Although VERY commonly used, arrays have limited capabilities  A List is similar to an array but provides additional functionality, such as dynamic.
C# 2.0 and Future Directions Anders Hejlsberg Technical Fellow Microsoft Corporation.
C#: Future Directions in Language Innovation Anders Hejlsberg TLN307 Technical Fellow Microsoft Corporation.
LINQ & PLINQ (Parallel) Language Integrated Query.
CSCI 3327 Visual Basic Chapter 8: Introduction to LINQ and Collections UTPA – Fall 2011.
Inside LINQ to Objects How LINQ to Objects work Inside LINQ1.
Satisfy Your Technical Curiosity C# 3.0 Raj Pai Group Program Manager Microsoft Corporation
Adxstudio Portals Training
Linq Overview Vincent GERMAIN. Evolution - Rappel Langage  C# 2.0  C# 3.0 (Local type inference, Lambda expression, Method extension,Anonymous type)
CSCI 3328 Object Oriented Programming in C# Chapter 8: LINQ and Generic Collections – Exercises 1 Xiang Lian The University of Texas – Pan American Edinburg,
Damien Guard (BSc, MBCS) Guernsey Software Developer Forum Language Integrated Query:
IAP C# 2011 Lecture 2: Delegates, Lambdas, LINQ Geza Kovacs.
LINQ Language Integrated Query LINQ1. LINQ: Why and what? Problem Many data sources: Relational databases, XML, in-memory data structures, objects, etc.
Creating the optimal product discovery experience with EPiServer Find Mark Hall Product Owner EPiServer Commerce.
Sitecore. Compelling Web Experiences Page 1www.sitecore.net Patrick Schweizer Director of Sales Enablement 2013.
Functional Programming Data Aggregation and Nested Queries Ivan Yonkov Technical Trainer Software University
The New Design Manager! Louis-Philippe Lavoie SharePoint Specialist / What does it mean for you? November.
Functional Programming
Introduction to Entity Framework
Jim Fawcett CSE681 – Software Modeling and Analysis Fall 2016
© 2016, Mike Murach & Associates, Inc.
Jim Fawcett CSE681 – Software Modeling and Analysis Fall 2013
Intro to LINQ Part 2 – Concepts and LINQ to Objects
Language Integrated Query: (LINQ) An introduction
02 | Querying Tables with SELECT
.NET and .NET Core 9. Towards Higher Order Pan Wuming 2017.
CSCI 3328 Object Oriented Programming in C# Chapter 8: LINQ and Generic Collections UTPA – Fall 2012 This set of slides is revised from lecture slides.
LINQ & ADO.NET Entity Framework
LINQ - 2 Ravi Kumar C++/C# Team.
CSCI 3328 Object Oriented Programming in C# Chapter 8: LINQ and Generic Collections – Exercises UTPA – Fall 2012 This set of slides is revised from lecture.
02 | Querying Tables with SELECT
Advanced .NET Programming I 6th Lecture
CS4540 Special Topics in Web Development LINQ to Objects
Presentation transcript:

Zoeken met Sitecore 7 Egbert Wietses pionect.nl

Waar komen we vandaan? http://marketplace.sitecore.net/en/Modules/Sitecore_Item_Buckets.aspx

Item buckets Niet zichtbaar (standaard) Theoretisch ongelimiteerd aantal subitems Geen parent child relatie

Handig om te weten <setting name="BucketConfiguration.BucketFolderPath" value=„yyyy\/MM\/dd\/HH\/mm”/> <field fieldName="group" storageType="YES" indexType="TOKENIZED"    vectorType="NO" boost="1f" type="System.GUID" settingType="Sitecore.ContentSearch.LuceneProvider.LuceneSearchFieldConfiguration, Sitecore.ContentSearch.LuceneProvider”> Luke = your friend https://code.google.com/p/luke/

Zoeken using (var context = ContentSearchManager.GetIndex(bucketItem as IIndexable).CreateSearchContext()) { var querySearch = context.GetQueryable<Models.Product>(); querySearch = querySearch.Where(item => item._language.Equals("en")); querySearch = querySearch.Where(item => item._templatename.Equals(MasterProductPage.TEMPLATE_NAME)); querySearch = querySearch.Where(item => item.brand.Equals("TRUST")); var products = querySearch.ToList(); } public class Product : SearchResultItem         public string _group { get; set; }         public string _name { get; set; }         public string _language { get; set; }         public string _templatename { get; set; }         public string color { get; set; }         public string device { get; set; }         public string feature { get; set; }         public string operatingSystem { get; set; }         public string compatibility { get; set; }

Facet Search

Coveo

Linq to Sitecore = gold All Any Between — with an extra overload for including or excluding the start and end ranges. Boost — makes this part of the query more important than the other parts. Cast — you can use this instead of Select. Contains Count ElementAt EndsWith Equal Facets — an extension that fetches the facets of predicates. First FirstOrDefault Last LastOrDefault Min Max Match — an extension for running regular expression queries. OrderBy OrderByDescending Select Single SingleOrDefault Skip Reverse Take ToList() ToLookUp() ToDictionary() Page — an extension that does Skip and Take automatically for you. StartsWith Union

Facet implementatie public static IQueryable<Facet> GetFacets(IQueryable<Product> query, string[] facets)         {             var facetGroups = new List<Facet>();             query = facets.Aggregate(query, (current, facetName) => current.FacetOn(c => c[facetName]));             FacetResults facetResults = query.GetFacets();             foreach (FacetCategory category in facetResults.Categories)             {                 var group = new Facet(key, friendlyName);                 foreach (Sitecore.ContentSearch.Linq.FacetValue facetValue in category.Values)                 {                     group.Values.Add(new Models.FacetValue(facetValue.Name, facetValue.Aggregate));                 }                 facetGroups.Add(group);             }             return facetGroups.AsQueryable();         }

Verschillende queries, verschillende taken

1 Call using (var context = ContentSearchManager.GetIndex("sitecore_master_index").CreateSearchContext()) { var results = context.GetQueryable<Product>().Where(prod => prod.Content.Contains("search box text").FacetOn(f => f.Color).FacetOn(f => f.Gender)).GetResults(); int totalHits = results.TotalHits; var searchResuls = results.Hits; var facets = results.Facets; }

namespace Sitecore.ContentSearch.Linq {     public static class QueryableExtensions     {         public static IQueryable<TSource> FacetOn<TSource, TKey>(this IQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector);         public static IQueryable<TSource> FacetOn<TSource, TKey>(this IQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, int minimumResultCount);         public static IQueryable<TSource> FacetOn<TSource, TKey>(this IQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, int minimumResultCount, IEnumerable<object> filterValues);         public static IQueryable<TSource> FacetPivotOn<TSource>(this IQueryable<TSource> source, Expression<Func<FacetPivotQuery<TSource>, FacetPivotQuery<TSource>>> keySelector);         public static IQueryable<TSource> FacetPivotOn<TSource>(this IQueryable<TSource> source, Expression<Func<FacetPivotQuery<TSource>, FacetPivotQuery<TSource>>> keySelector, int minimumResultCount);         public static IQueryable<TSource> Filter<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, bool>> predicate);         public static FacetResults GetFacets<TSource>(this IQueryable<TSource> source);         public static SearchResults<TSource> GetResults<TSource>(this IQueryable<TSource> source);         public static SearchResults<TSource> GetResults<TSource>(this IQueryable<TSource> source, GetResultsOptions options);         public static IQueryable<TSource> Page<TSource>(this IQueryable<TSource> source, int page, int pageSize);     } }

Linq voorbeeld resultsQuery = resultsQuery.Where(item =>                     item.Path.StartsWith("/sitecore/content/sites/autohouse")                     && !item.ExcludeFromSearchResults                     && (item.TemplateName == ContentPage.TEMPLATE_NAME                     || item.TemplateName == NewsDetailPage.TEMPLATE_NAME                     || (item.TemplateName == MasterProductPage.TEMPLATE_NAME                             && item.brand.Equals("Brand X")                             && (item.useforsupport.Equals("1") || item.useforconsumerassortment.Equals("1")))                     || (item.TemplateName == ColorProductPage.TEMPLATE_NAME                     )                     && item.Language.StartsWith(lang)).OrderByDescending(x => x.itemno);

Predicate Builder = one to watch OR AND XOR Controleren tegen lijst van iD’s

In de praktijk Luke = your friend

Achtergrond informatie Sitecore 7 Autohaus project https://github.com/Sitecore/autohaus Developers guide to item buckets and search https://sdn.sitecore.net/Reference/Sitecore%207/ Developers%20Guide%20to%20Item%20Bucket s%20and%20Search.aspx