\documentclass[10pt,a4paper]{article} % Packages \usepackage{fancyhdr} % For header and footer \usepackage{multicol} % Allows multicols in tables \usepackage{tabularx} % Intelligent column widths \usepackage{tabulary} % Used in header and footer \usepackage{hhline} % Border under tables \usepackage{graphicx} % For images \usepackage{xcolor} % For hex colours %\usepackage[utf8x]{inputenc} % For unicode character support \usepackage[T1]{fontenc} % Without this we get weird character replacements \usepackage{colortbl} % For coloured tables \usepackage{setspace} % For line height \usepackage{lastpage} % Needed for total page number \usepackage{seqsplit} % Splits long words. %\usepackage{opensans} % Can't make this work so far. Shame. Would be lovely. \usepackage[normalem]{ulem} % For underlining links % Most of the following are not required for the majority % of cheat sheets but are needed for some symbol support. \usepackage{amsmath} % Symbols \usepackage{MnSymbol} % Symbols \usepackage{wasysym} % Symbols %\usepackage[english,german,french,spanish,italian]{babel} % Languages % Document Info \author{Kiran Patil (kpatil)} \pdfinfo{ /Title (sitecore-search-developers.pdf) /Creator (Cheatography) /Author (Kiran Patil (kpatil)) /Subject (Sitecore Search Developers Cheat Sheet) } % Lengths and widths \addtolength{\textwidth}{6cm} \addtolength{\textheight}{-1cm} \addtolength{\hoffset}{-3cm} \addtolength{\voffset}{-2cm} \setlength{\tabcolsep}{0.2cm} % Space between columns \setlength{\headsep}{-12pt} % Reduce space between header and content \setlength{\headheight}{85pt} % If less, LaTeX automatically increases it \renewcommand{\footrulewidth}{0pt} % Remove footer line \renewcommand{\headrulewidth}{0pt} % Remove header line \renewcommand{\seqinsert}{\ifmmode\allowbreak\else\-\fi} % Hyphens in seqsplit % This two commands together give roughly % the right line height in the tables \renewcommand{\arraystretch}{1.3} \onehalfspacing % Commands \newcommand{\SetRowColor}[1]{\noalign{\gdef\RowColorName{#1}}\rowcolor{\RowColorName}} % Shortcut for row colour \newcommand{\mymulticolumn}[3]{\multicolumn{#1}{>{\columncolor{\RowColorName}}#2}{#3}} % For coloured multi-cols \newcolumntype{x}[1]{>{\raggedright}p{#1}} % New column types for ragged-right paragraph columns \newcommand{\tn}{\tabularnewline} % Required as custom column type in use % Font and Colours \definecolor{HeadBackground}{HTML}{333333} \definecolor{FootBackground}{HTML}{666666} \definecolor{TextColor}{HTML}{333333} \definecolor{DarkBackground}{HTML}{DC4437} \definecolor{LightBackground}{HTML}{FCF3F2} \renewcommand{\familydefault}{\sfdefault} \color{TextColor} % Header and Footer \pagestyle{fancy} \fancyhead{} % Set header to blank \fancyfoot{} % Set footer to blank \fancyhead[L]{ \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{C} \SetRowColor{DarkBackground} \vspace{-7pt} {\parbox{\dimexpr\textwidth-2\fboxsep\relax}{\noindent \hspace*{-6pt}\includegraphics[width=5.8cm]{/web/www.cheatography.com/public/images/cheatography_logo.pdf}} } \end{tabulary} \columnbreak \begin{tabulary}{11cm}{L} \vspace{-2pt}\large{\bf{\textcolor{DarkBackground}{\textrm{Sitecore Search Developers Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{Kiran Patil (kpatil)} via \textcolor{DarkBackground}{\uline{cheatography.com/20093/cs/2946/}}} \end{tabulary} \end{multicols}} \fancyfoot[L]{ \footnotesize \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{LL} \SetRowColor{FootBackground} \mymulticolumn{2}{p{5.377cm}}{\bf\textcolor{white}{Cheatographer}} \\ \vspace{-2pt}Kiran Patil (kpatil) \\ \uline{cheatography.com/kpatil} \\ \uline{\seqsplit{sitecorebasics}.wordpress.com/} \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Cheat Sheet}} \\ \vspace{-2pt}Published 29th November, 2014.\\ Updated 11th May, 2016.\\ Page {\thepage} of \pageref{LastPage}. \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Sponsor}} \\ \SetRowColor{white} \vspace{-5pt} %\includegraphics[width=48px,height=48px]{dave.jpeg} Measure your website readability!\\ www.readability-score.com \end{tabulary} \end{multicols}} \begin{document} \raggedright \raggedcolumns % Set font size to small. Switch to any value % from this page to resize cheat sheet text: % www.emerson.emory.edu/services/latex/latex_169.html \footnotesize % Small font. \begin{multicols*}{3} \begin{tabularx}{5.377cm}{p{0.73232 cm} x{1.8308 cm} x{2.01388 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{5.377cm}}{\bf\textcolor{white}{Basics}} \tn % Row 0 \SetRowColor{LightBackground} Terms \& \seqsplit{Phrases} & "test" or "hello dolly" & `c.Where("test") or c.Where("hello dolly") or c.Where("test" || "hello dolly")` \tn % Row Count 5 (+ 5) % Row 1 \SetRowColor{white} \seqsplit{Fields} & title:"The Right way" and text:"go" & `c.Title == "The Right way" or c.Text == "go" {\bf{or}} c.Equals("go")` \tn % Row Count 9 (+ 4) % Row 2 \SetRowColor{LightBackground} \seqsplit{WildCard} & {\emph{amber}} & \seqsplit{`c.ContactName.Contains} ("amber")` \tn % Row Count 11 (+ 2) % Row 3 \SetRowColor{white} \seqsplit{Prefix} & amber{\emph{ }}amber & \seqsplit{c.ContactName.StartsWith("amber")} or \seqsplit{c.ContactName.EndsWith("amber")} \tn % Row Count 15 (+ 4) % Row 4 \SetRowColor{LightBackground} Fuzzy & roam\textasciitilde{} or roam\textasciitilde{}0.8 & \seqsplit{`c.ContactName.Like("roam")} or \seqsplit{c.ContactName.Like("roam"}, 0.8)` \tn % Row Count 19 (+ 4) % Row 5 \SetRowColor{white} \seqsplit{Proximity} & "jakarta apache"\textasciitilde{}10 & \seqsplit{`c.ContactName.Like("jakarta} apache", 10)` \tn % Row Count 22 (+ 3) % Row 6 \SetRowColor{LightBackground} \seqsplit{Inclusive} Range & mod\_date:{[}20020101 TO 20030101{]} & \seqsplit{`c.ModifiedDate.Between("20020101"}, "20030101", Inclusion.Both)` \tn % Row Count 26 (+ 4) % Row 7 \SetRowColor{white} \seqsplit{Exclusive} Range & title:\{Aida TO Carmen\} & \seqsplit{`c.Title.Between("Aida"}, "Carmen", Inclusion.None)` \tn % Row Count 29 (+ 3) % Row 8 \SetRowColor{LightBackground} \seqsplit{Boosting} & jakarta\textasciicircum{}4 apache & \seqsplit{`c.Title.Equals("jakarta".Boost(4))} || \seqsplit{c.Title.Equals("apache")`} \tn % Row Count 33 (+ 4) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{5.377cm}{p{0.73232 cm} x{1.8308 cm} x{2.01388 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{5.377cm}}{\bf\textcolor{white}{Basics (cont)}} \tn % Row 9 \SetRowColor{LightBackground} \seqsplit{Boolean} Or & "jakarta apache" OR jakarta & `where \seqsplit{c.Title.Equals("jakarta} apache") || \seqsplit{c.Equals("jakarta")`} \tn % Row Count 4 (+ 4) % Row 10 \SetRowColor{white} \seqsplit{Boolean} And & "jakarta apache" AND "Apache Lucene" & `where \seqsplit{c.Equals("jakarta} apache") \&\& c.Equals("Apache Lucene")` \tn % Row Count 8 (+ 4) % Row 11 \SetRowColor{LightBackground} \seqsplit{Boolean} Not & "jakarta apache" NOT "Apache Lucene" & `where \seqsplit{c.Equals("jakarta} apache") \&\& !c.Equals("Apache Lucene")` \tn % Row Count 12 (+ 4) % Row 12 \SetRowColor{white} \seqsplit{Grouping} & (jakarta OR apache) AND website & `where (c.Title == "jakarta" || c.Title == "apache") \&\& (c.Title == "website")` \tn % Row Count 17 (+ 5) \hhline{>{\arrayrulecolor{DarkBackground}}---} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.14425 cm} x{1.32733 cm} x{2.10542 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{5.377cm}}{\bf\textcolor{white}{Supported IQueryable methods}} \tn % Row 0 \SetRowColor{LightBackground} \seqsplit{Restriction} Operators & Where & `var results = from d in queryable where d.Name == "Sitecore" select d;` {\bf{or}} `var results = queryable.Where(d =\textgreater{} d.Name == "Sitecore");` \tn % Row Count 8 (+ 8) % Row 1 \SetRowColor{white} \seqsplit{Projection} Operators & Select & `var results = from d in queryable select d.Name;` {\bf{or}} `var results = \seqsplit{queryable.Select(d} =\textgreater{} d.Name);` \tn % Row Count 14 (+ 6) % Row 2 \SetRowColor{LightBackground} Anonymous types & & `results = \seqsplit{queryable.Select(d} =\textgreater{} new \{ d.Name, d.Id \});` \tn % Row Count 18 (+ 4) % Row 3 \SetRowColor{white} \seqsplit{Unsupported} & SelectMany & \tn % Row Count 20 (+ 2) % Row 4 \SetRowColor{LightBackground} \seqsplit{Partitioning} Operators & Take & results =` \seqsplit{queryable.Take(10);`} \tn % Row Count 23 (+ 3) % Row 5 \SetRowColor{white} \seqsplit{Partitioning} Operators & Skip & `results = \seqsplit{queryable.Skip(10);`} \tn % Row Count 26 (+ 3) % Row 6 \SetRowColor{LightBackground} \seqsplit{Partitioning} Operators & Page & `results = queryable.Page(2, 100);` \tn % Row Count 29 (+ 3) % Row 7 \SetRowColor{white} Ordering Operators & OrderBy & results = \seqsplit{queryable.OrderBy(d} =\textgreater{} d.Name); \tn % Row Count 32 (+ 3) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{5.377cm}{x{1.14425 cm} x{1.32733 cm} x{2.10542 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{5.377cm}}{\bf\textcolor{white}{Supported IQueryable methods (cont)}} \tn % Row 8 \SetRowColor{LightBackground} Ordering Operators & OrderBy Descending & results = \seqsplit{queryable.OrderByDescending(d} =\textgreater{} d.Name); \tn % Row Count 3 (+ 3) % Row 9 \SetRowColor{white} Ordering Operators & ThenBy & results = \seqsplit{queryable.OrderBy(d} =\textgreater{} d.Name).ThenBy(d =\textgreater{} d.Id); \tn % Row Count 7 (+ 4) % Row 10 \SetRowColor{LightBackground} Ordering Operators & ThenBy Descending & results = \seqsplit{queryable.OrderBy(d} =\textgreater{} \seqsplit{d.Name).ThenByDescending(d} =\textgreater{} d.Id); \tn % Row Count 11 (+ 4) % Row 11 \SetRowColor{white} \seqsplit{Unsupported} & Reverse & \tn % Row Count 13 (+ 2) % Row 12 \SetRowColor{LightBackground} Grouping Operators & \seqsplit{Unsupported} & GroupBy -Simple 1 GroupBy -Simple 2 GroupBy -Simple 3 GroupBy -Nested GroupBy -Comparer GroupBy -Comparer, Mapped \tn % Row Count 20 (+ 7) % Row 13 \SetRowColor{white} Set Operators & \seqsplit{Unsupported} & Distinct Union Intersect Except \tn % Row Count 22 (+ 2) % Row 14 \SetRowColor{LightBackground} Element Operators & First -Simple & `results = \seqsplit{queryable.First();`} \tn % Row Count 24 (+ 2) % Row 15 \SetRowColor{white} Element Operators & First -Condition & `results = queryable.First(d =\textgreater{} d.Name == "Sitecore");` \tn % Row Count 28 (+ 4) % Row 16 \SetRowColor{LightBackground} Element Operators & \seqsplit{FirstOrDefault} -Simple & `results = \seqsplit{queryable.FirstOrDefault();`} \tn % Row Count 31 (+ 3) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{5.377cm}{x{1.14425 cm} x{1.32733 cm} x{2.10542 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{5.377cm}}{\bf\textcolor{white}{Supported IQueryable methods (cont)}} \tn % Row 17 \SetRowColor{LightBackground} Element Operators & \seqsplit{FirstOrDefault} -Condition & `results = \seqsplit{queryable.FirstOrDefault(d} =\textgreater{} d.Name == "Sitecore");` \tn % Row Count 4 (+ 4) % Row 18 \SetRowColor{white} Element Operators & ElementAt & `results = \seqsplit{queryable.ElementAt(10);`} \tn % Row Count 6 (+ 2) % Row 19 \SetRowColor{LightBackground} Element Operators & Last & 'result = \seqsplit{queryable.Last();'} {\bf{or}} `result = queryable.Last(d =\textgreater{} d.Id \textgreater{} 10);` \tn % Row Count 11 (+ 5) % Row 20 \SetRowColor{white} Element Operators & \seqsplit{LastOrDefault} & `result = \seqsplit{queryable.LastOrDefault();`} or `result = \seqsplit{queryable.LastOrDefault(d} =\textgreater{} d.Id \textgreater{} 10);` \tn % Row Count 17 (+ 6) % Row 21 \SetRowColor{LightBackground} Element Operators & Single & `result = \seqsplit{queryable.Single();`} {\bf{or}} `result = \seqsplit{queryable.Single(d} =\textgreater{} d.Id \textgreater{} 10);` \tn % Row Count 22 (+ 5) % Row 22 \SetRowColor{white} Element Operators & \seqsplit{SingleOrDefault} & `result = \seqsplit{queryable.SingleOrDefault();`} {\bf{or}} `result = \seqsplit{queryable.SingleOrDefault(d} =\textgreater{} d.Id \textgreater{} 10);` \tn % Row Count 28 (+ 6) % Row 23 \SetRowColor{LightBackground} \seqsplit{Quantifiers} & Any -Simple & `results = queryable.Any();` \tn % Row Count 30 (+ 2) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{5.377cm}{x{1.14425 cm} x{1.32733 cm} x{2.10542 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{5.377cm}}{\bf\textcolor{white}{Supported IQueryable methods (cont)}} \tn % Row 24 \SetRowColor{LightBackground} \seqsplit{Quantifiers} & Any -Grouped & `results = queryable.Any(d =\textgreater{} d.Name == "Sitecore");` \tn % Row Count 3 (+ 3) % Row 25 \SetRowColor{white} \seqsplit{Quantifiers} & \seqsplit{Unsupported} & All \tn % Row Count 5 (+ 2) % Row 26 \SetRowColor{LightBackground} Aggregate Operators & Count -Simple & `results = \seqsplit{queryable.Count();`} \tn % Row Count 7 (+ 2) % Row 27 \SetRowColor{white} Aggregate Operators & Count \seqsplit{-Conditional} & `results = queryable.Count(d =\textgreater{} d.Id \textless{} 10);` \tn % Row Count 10 (+ 3) % Row 28 \SetRowColor{LightBackground} Aggregate Operators & \seqsplit{Unsupported} & Sum Min Max Average Aggregate \tn % Row Count 12 (+ 2) % Row 29 \SetRowColor{white} Join Operators & \seqsplit{Unsupported} & Cross Join Group Join Cross Join with Group Join Left Outer Join \tn % Row Count 16 (+ 4) \hhline{>{\arrayrulecolor{DarkBackground}}---} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{p{0.68655 cm} x{1.14425 cm} x{2.7462 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{5.377cm}}{\bf\textcolor{white}{IQueryable Extensions}} \tn % Row 0 \SetRowColor{LightBackground} \seqsplit{Filtering} & & `results = queryable.Filter(d =\textgreater{} d.Id \textgreater{} 4 \&\& d.Id \textless{} 8);` \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} \seqsplit{Facets} & Simple Faceting & `var results = queryable.FacetOn(d =\textgreater{} d.Name); var facets = results.GetFacets(); foreach (var category in facets.Categories) \{ \seqsplit{Console.WriteLine(category} .Name); foreach (var facetValue in category.Values) \{ Console.WriteLine("\{0\}: \{1\}", facetValue.Name, facetValue.Aggregate); \} \}` \tn % Row Count 15 (+ 12) % Row 2 \SetRowColor{LightBackground} & Pivot Faceting & `var results = \seqsplit{queryable.FacetPivotOn(p} =\textgreater{} p.FacetOn(d =\textgreater{} d.Name).FacetOn(d =\textgreater{} d.Year)); var facets = results.GetFacets(); foreach (var category in facets.Categories) \{ \seqsplit{Console.WriteLine(category} .Name); foreach (var facetValue in category.Values) \{ Console.WriteLine("\{0\}: \{1\}", facetValue.Name, facetValue.Aggregate); \} \}` \tn % Row Count 29 (+ 14) % Row 3 \SetRowColor{white} \seqsplit{Boosting} & & `results = queryable.Where(d =\textgreater{} d.Id == 7.Boost(2f)).Where(d =\textgreater{} \seqsplit{d.Template.Contains("o"));`} \tn % Row Count 33 (+ 4) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{5.377cm}{p{0.68655 cm} x{1.14425 cm} x{2.7462 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{5.377cm}}{\bf\textcolor{white}{IQueryable Extensions (cont)}} \tn % Row 4 \SetRowColor{LightBackground} Other & Between & `results = queryable.Where(item =\textgreater{} \seqsplit{item.Price.Between(50.0f}, 400.0f, Inclusion.Both));` {\bf{or}} `results = queryable.Where(item =\textgreater{} item.Price.Between(2.0f, 12.0f, Inclusion.Both) || \seqsplit{item.Price.Between(80.0f}, 400.0f, Inclusion.Both));` {\bf{or}} `results = queryable.Where(d =\textgreater{} d.Date.Between(new DateTime(2004, 12, 31), DateTime.Now, Inclusion.Both));` {\bf{or}} `results = queryable.Where(d =\textgreater{} d.Id.Between(1, 4, Inclusion.Both));` {\bf{or}} `results = queryable.Where(d =\textgreater{} d.Id.Between(1, 4, Inclusion.Lower));` {\bf{or}} `results = queryable.Where(d =\textgreater{} d.Id.Between(1, 4, Inclusion.Upper));` {\bf{or}} `results = queryable.Where(d =\textgreater{} d.Id.Between(1, 4, Inclusion.None));` \tn % Row Count 28 (+ 28) % Row 5 \SetRowColor{white} Other & \seqsplit{string.Contains} & `results = queryable.Where(d =\textgreater{} !d.Template.Contains("Hello:));` \tn % Row Count 31 (+ 3) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{5.377cm}{p{0.68655 cm} x{1.14425 cm} x{2.7462 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{5.377cm}}{\bf\textcolor{white}{IQueryable Extensions (cont)}} \tn % Row 6 \SetRowColor{LightBackground} Other & \seqsplit{string.CompareTo} & `results = queryable.Where(d =\textgreater{} !d.Name.CompareTo("Hello") == 1);` \tn % Row Count 3 (+ 3) % Row 7 \SetRowColor{white} Other & Equal & `results = queryable.Where(d =\textgreater{} d.Id.Equal(4));` \tn % Row Count 5 (+ 2) % Row 8 \SetRowColor{LightBackground} Other & Matches & `results = queryable.Where(i =\textgreater{} i.Template.Matches("\textasciicircum{}.*\$"));` \tn % Row Count 8 (+ 3) % Row 9 \SetRowColor{white} Other & \seqsplit{MatchWildcard} & `results = queryable.Where(i =\textgreater{} i.Template.Where(i =\textgreater{} \seqsplit{i.Template.MatchWildcard("H?li*m")));`} \tn % Row Count 12 (+ 4) % Row 10 \SetRowColor{LightBackground} Other & Like & `results = queryable.Where(i =\textgreater{} \seqsplit{i.Template.Like("Citecoar"));`} \tn % Row Count 15 (+ 3) % Row 11 \SetRowColor{white} Other & \seqsplit{string.StartsWith} & `results = queryable.Where(d =\textgreater{} !d.Name.StartsWith("Hello"));` \tn % Row Count 18 (+ 3) % Row 12 \SetRowColor{LightBackground} Other & \seqsplit{string.EndsWith} & `results = queryable.Where(d =\textgreater{} !d.Name.EndsWith("Hello"));` \tn % Row Count 21 (+ 3) % Row 13 \SetRowColor{white} \seqsplit{GetResults} & & `results = \seqsplit{queryable.GetResults().Hits.Where(i} =\textgreater{} \seqsplit{i.Document.Name.Contains("o")).Where(hit} =\textgreater{} hit.Score \textgreater{} 0.6);` \tn % Row Count 26 (+ 5) % Row 14 \SetRowColor{LightBackground} \seqsplit{GetFacets} & & `results = queryable.Where(d =\textgreater{} d.Id \textgreater{} 0).FacetOn(d =\textgreater{} d.Template, 0).GetFacets();` \tn % Row Count 30 (+ 4) \hhline{>{\arrayrulecolor{DarkBackground}}---} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{2.4885 cm} x{2.4885 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Daily Life usages}} \tn % Row 0 \SetRowColor{LightBackground} This returns the results of a query on your search index and returns it as a SearchResultItem type. & `using (var context = \seqsplit{ContentSearchManager}.GetIndex(item).CreateSearchContext()) \{ IQueryable\textless{}SearchResultItem\textgreater{} searchQuery = context.GetQueryable\textless{}SearchResultItem\textgreater{}().Where(item =\textgreater{} item.Name == "Sitecore") \}` \tn % Row Count 11 (+ 11) % Row 1 \SetRowColor{white} This converts the query to something your provider understands. For example, for Lucene it is converted to: \_name:sitecore & `using (var context = \seqsplit{ContentSearchManager}.GetIndex(item).CreateSearchContext()) \{ IQueryable\textless{}SearchResultItem\textgreater{} searchQuery = context.GetQueryable\textless{}SearchResultItem\textgreater{}().Where(item =\textgreater{} item{[}"\_name"{]} == "Sitecore") \}` \tn % Row Count 23 (+ 12) % Row 2 \SetRowColor{LightBackground} +(+\_name:sitecore) +(title:test body:{\emph{cms}}) or \seqsplit{(+(+\_name:sitecore)} +(title:test body:{\emph{cms}})) & `using (var context = \seqsplit{ContentSearchManager}.GetIndex(item).CreateSearchContext()) \{ IQueryable\textless{}SearchResultItem\textgreater{} searchQuery = context.GetQueryable\textless{}SearchResultItem\textgreater{}().Where(item =\textgreater{} item{[}"\_name"{]} == \seqsplit{"Sitecore").Where(item} =\textgreater{} item.Title == "Test || \seqsplit{item.Body.Contains("CMS"))} \} OR using (var context = \seqsplit{ContentSearchManager}.GetIndex \seqsplit{(item).CreateSearchContext())} \{ IQueryable\textless{}SearchResultItem\textgreater{} searchQuery = context.GetQueryable\textless{}SearchResultItem\textgreater{} ().Where(item =\textgreater{} item.Name == \seqsplit{"Sitecore").Where(item} =\textgreater{} item.Title == "Test || \seqsplit{item.Body.Contains("CMS")`} \tn % Row Count 52 (+ 29) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{5.377cm}{x{2.4885 cm} x{2.4885 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Daily Life usages (cont)}} \tn % Row 3 \SetRowColor{LightBackground} Find all the items that have "s" in their names & `var index = \seqsplit{ContentSearchManager}.GetIndex("sitecore\_master\_index"); using (var context = \seqsplit{index.CreateSearchContext())} \{ Console.WriteLine( context.GetQueryable\textless{}SearchResultItem\textgreater{}().Where(resultItem=\textgreater{}resultItem.Name.Contains("s")) );` \tn % Row Count 12 (+ 12) % Row 4 \SetRowColor{white} Finding the first item named Sitecore & `context.GetQueryable\textless{}SearchResultItem\textgreater{}().FirstOrDefault(resultItem=\textgreater{}resultItem.Name=="sitecore")` \tn % Row Count 17 (+ 5) % Row 5 \SetRowColor{LightBackground} Finding the count of items in a database & `context.GetQueryable\textless{}SearchResultItem\textgreater{}().Count()` \tn % Row Count 20 (+ 3) % Row 6 \SetRowColor{white} Finding all the items that use a certain template & context.GetQueryable\textless{}SearchResultItem\textgreater{}().Where(resultItem=\textgreater{}resultItem.TemplateName=="Sample Item") \tn % Row Count 25 (+ 5) % Row 7 \SetRowColor{LightBackground} same thing as above but this time using the template id & `context.GetQueryable\textless{}SearchResultItem\textgreater{}().Where(resultItem=\textgreater{}resultItem.TemplateId==ID.Parse("\{76036F5E-CBCE-46D1 -AF0A-4143F9B557AA\}"))` \tn % Row Count 32 (+ 7) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{5.377cm}{x{2.4885 cm} x{2.4885 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Daily Life usages (cont)}} \tn % Row 8 \SetRowColor{LightBackground} find all items that have some content in the "Page Title" field & `context.GetQueryable\textless{}SearchResultItem\textgreater{}().Where(resultItem=\textgreater{}resultItem{[}"page\_title"{]}!=""` \tn % Row Count 5 (+ 5) % Row 9 \SetRowColor{white} find all items that have lorem in the body & `context.GetQueryable\textless{}SearchResultItem\textgreater{}().Where(resultItem=\textgreater{}resultItem{[}"body"{]}.Contains("lorem"))` \tn % Row Count 10 (+ 5) % Row 10 \SetRowColor{LightBackground} finding an item where item.Fields{[}"Taxonomy Items"{]} // is a multi list field and contains "\{016424DF-865C-49DC- 9D7A-40EB8101C717\}" & `context.GetQueryable\textless{}SearchResultItem\textgreater{}() .Where(resultItem=\textgreater{}resultItem{[}"taxonomy\_items"{]}.Contains(Sitecore.ContentSearch.Utilities.IdHelper.NormalizeGuid ("\{016424DF-865C-49DC-9D7A-40EB8101C717\}",true)))` \tn % Row Count 21 (+ 11) % Row 11 \SetRowColor{white} Find items based on Data Source string & ` var query = \seqsplit{LinqHelper.CreateQuery(context}, \seqsplit{UIFilterHelpers.ParseDatasourceString(txtQuery.Text.Trim())).Select(x} =\textgreater{} x.GetItem()) .AsEnumerable() .Where(x =\textgreater{} x.Language == \seqsplit{Sitecore.Context.Language)`} \tn % Row Count 35 (+ 14) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{2.4885 cm} x{2.4885 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Advanced Usages}} \tn % Row 0 \SetRowColor{LightBackground} Get Particular template's item for current website and latest version of an item only & `var searchResultItem = context.GetQueryable\textless{}SearchResultItem\textgreater{}() .Where(x =\textgreater{} \seqsplit{x.Path.Contains(sitecoreItem.Paths.FullPath))} .Where(x =\textgreater{} x.TemplateId == \seqsplit{Sitecore.Data.ID.Parse("YOURTEMPLATEID"))} .AsEnumerable() .Where(x =\textgreater{} x != null \&\& x.GetItem() != null \&\& x.Version == \seqsplit{x.GetItem().Versions.} \seqsplit{GetLatestVersion().Version.ToString());`} \tn % Row Count 27 (+ 27) % Row 1 \SetRowColor{white} To get all details related to search index like IsClean, LastUpdated, NumberOfDocuments,NumberOfFields & `ISearchIndex isearchIndex = \seqsplit{ContentSearchManager}.GetIndex("YOURINDEXNAME");` \tn % Row Count 33 (+ 6) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{5.377cm}{x{2.4885 cm} x{2.4885 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Advanced Usages (cont)}} \tn % Row 2 \SetRowColor{LightBackground} The \_content field aggregates all fields from the item to allow full text searching & `{[}IndexField(Sitecore.ContentSearch.BuiltinFields.Content){]} public string ItemContent \{ get; set; \}` \tn % Row Count 7 (+ 7) % Row 3 \SetRowColor{white} To do your index field configuration & `\textless{}fieldMap \seqsplit{type="Sitecore.ContentSearch.FieldMap}, Sitecore.ContentSearch"\textgreater{} \textless{}fieldNames hint="raw:AddFieldByFieldName"\textgreater{}` \tn % Row Count 14 (+ 7) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}