Sitecore Training - Advanced Search (FTFM)

  • By Luke Stephenson
Luke Stephenson

 

 

Transcript:

In this video were going to be talking about building advanced search queries to help us efficiently find the items that are buried deep within our HUGE content tree.

In the last video/tutorial we covered the basics of using the search functionality so, if you haven’t already, we recommend that you watch that video first.

So here we are in the search tab, and I’m looking for an item that has something to do with our offices in Cardiff. The problem is that I can’t quite put my finger on what we called that item, or where we stored it in the content tree, so that’s a really good reason to use the search functionality.

Let’s start by typing the word Office into the keyword section and see what that returns:

office 58 results

As you can see, it gave us a total of 58 results but I don’t particularly want to look through all of the results to find the item that I’m looking for, so let’s add another keyword into the search field, and we’re going to use the word Building:

office building 90 results

You’ll notice that I’ve gone from 58 results, to 90 results, and you’re probably thinking “That’s not very helpful! When I’m more specific with my search I want Site core to give me fewer results, not more!”

Well actually, by typing in more keywords, you’re actually being less specific. You’re telling Sitecore to return results for any item that contains the keyword Office OR any item that contains the keyword Building…and 3chillies are really good “Building” Sitecore websites, hence the increased number of results when you add that as a keyword!

In this instance, I know the item we’re looking for was about the offices we have in Cardiff, so I’ll add that as a keyword too, and as expected, we have even more results: 110 in total.

office building cardiff 110 results

Now it’s time to get more specific, and we can do that with the help of a few really handy tools .

We’ve actually got the ability to tell Sitecore to search for items that MUST contain a specific keyword or MUST NOT contain a specific Keyword. To do that, click the magnifying glass right next to the keyword, and you’ll notice that a red X appears over the magnifying glass icon.

negative

If we were to hit the search button now, we’d be asking Sitecore to go look for every item that mentions the word office, as well as every item that mentions the word building, and then go through all of those results and exclude any result which mentions the word “Cardiff”. Let’s do that – and we’ve gone from 110 results to 77 results, because we added Cardiff as a negative keyword.

If we come over here and click the magnifying glass again, we’ll get this green plus sign, meaning the search should only return results if the word Cardiff IS mentioned in the item.

positive

So unless the item DOES mention Cardiff, it’ll be eliminated from the results. In this case, doing that returns 13 results, which is a much more manageable list to walk through, and we can use the other search features such as facets to filter down further if we’d like to.

Sitecore also supports the use of different symbols within the search field. The Asterisk symbol helps to find every form of a word. You can use the symbol inside a word, at the beginning or end of a word, or a combination of both. For example, searching for the word Econom*, will find any word starting with the word Econom regardless of what it ends with. So it’ll return results such as Economy, Economics, Economical etc. Similarly, searching for the word *Graph* will return results such as Paragraph, Paragraphing, Graphic, Photography and so on.

In some cases using an asterisk inside of a word can also be useful too. Typing Pe*ion into the search field here will return results for things like “Pensions” and “Personalisation”. Using the asterisk by itself, returns all of the sub items within the item you have selected in the content tree. For example, if you have the blog selected in the content tree, and you search for *, you’ll get all of the folders and all of the blog items returned upon search.

The question mark symbol replaces any single character at the beginning, end or inside of a word. For example, typing T?re into the search would return results like Tyre, Tire and Tore. I’ve found this can be really handy when you’re searching for a particular word which might be spelt differently depending on the market it was intended for. For example in the UK we spell personalisation with an S, whereas in America, they use a Z. So instead of searching each word individually, we’ll type Personal?ation, and instantly get the results for both.

Wrapping a word in quotation marks can help to search for an exact word of phrase, and finally, if you need to search within a certain range, Sitcore supports both numerical and text based ranges, for example you could write: Price:[400 TO 500] Or Title:[Algeria TO Bahrain]

scroll back to the top of the current web page