Helpful syntax for SharePoint search – comparing SharePoint 2010 Foundation, SharePoint 2010 Enterprise, and SharePoint 2013.
By Susan Hanley
I'm on a mission - I want to make sure that all SharePoint guidance (or the other G-word, governance) plans include training about a key information literacy skill: the ability to execute an effective online search. Improving "findability" is a key outcome goal for most SharePoint deployments. We often talk about metadata as the key to improving findability. But, to paraphrase a common expression, it's not just about having all your fish tagged so that they can be found, it's still about teaching people how to fish. And, in the context of information literacy, teaching people how to fish means teaching people how to search.
Last week, I was at the SPTech Con conference in Boston. During one of the sessions, a presenter advised the audience to never use an underscore "_" character in file names because, if you do, SharePoint search won't be able to distinguish the individual words - so you won't be able to find your content. That comment made me very nervous because in this blog and in pretty much every governance plan I've written, I've recommended that you use the underscore in file names to avoid the %20 issue in hyperlinks. I recommend underscores over dashes "-" or hyphens because dashes often cause wrapping issues when a long hyperlink is sent in an email message. I spent the better part of two days asking every SharePoint MVP and expert I could find at the conference whether or not the underscore was a valid word breaker. About half the people I asked told me definitively that it was not a valid word breaker, and half said that they were pretty sure that it was. Searching on the internet gave very mixed messages as well. So, I ran some controlled tests to find out. The answer is that everyone is right - at least some of the time!
- If you are using SharePoint Foundation, underscores are NOT a valid word breaker. If your file is named Sundance_Film_Festival.docx and you search for the word Film, you will not find your document.
- If you are using all other versions of SharePoint, underscores ARE a valid word breaker. If your file is named Sundance_Film_Festival.docx, you can search for any of the words Sundance, Film or Festival and you will get your document.
One thing you'll notice in the white paper is that the most "user friendly" search results are absolutely in SharePoint 2013. Providing a better end-user search experience could be significant in your justification for migration. To help in the meantime, here are 10 search hints that will help your users get better search results now. (Note that the white paper has all of the content in this blog post plus more - and it's a little easier to read.)
The first three hints are about helping make search work in the first place. They are directed to content publishers and site owners. The remaining hints will help content finders once they've got a good foundation.
TIPS FOR CONTENT PUBLISHERS AND SITE OWNERS
- Use metadata to help search find content. Search engines in general use weighting algorithms to know whether the terms you are searching for match the items to be searched. If your term matches the terms in the File Name, Title, or other metadata, the item will usually be weighted higher than if the term is in the document text. That's one of many reasons to use metadata to organize your content.
- Use meaningful file names and titles. File names and titles are very important metadata attributes. By default, SharePoint search results prominently feature the Title of a document. If Title is blank, results feature the file name.
- If you are using SharePoint Foundation, please take a look at the file name recommendations in this post and ignore what I say about recommending underscores as word separators. Use dashes . (Spaces will also work, but they make for messy hyperlinks.)
- For all other versions of SharePoint, use underscores "_" or dashes "-" to separate words in filenames. I prefer underscores for the reasons in the blog post referenced above, but either will work. Use spaces between words in Titles.
- Do not "smush" words together without a separator in file names or titles for documents. If you do, the search engine won't recognize the separate words.
TIPS FOR CONTENT "FINDERS"
- Use OR to expand your search to include more terms. One of the reasons that you may not get the results you are looking for in search is that you are not giving the search engine enough of a clue to find what you want. It's a good idea to use more than one word to search. If you don't get the results you want, try adding more terms to your search. To be certain that the search engine knows how you want to connect the terms, you must separate the words with an operator. For more results, the operator is probably "OR" - and you need to make sure that you capitalize OR. (By the way, this is true for Google as well, though Google will attempt to interpret whether you mean AND or OR, it doesn't always get it right.) It is always safest to capitalize your search operators.
- Use AND to narrow your search results. Most search engines, including SharePoint, assume that two words together with no operator separating them implies AND as the operator. In other words, a search for apples pears is the same as apples AND pears. Get in the habit of including the operator - in capital letters or it will be ignored.
- Use double quotes to find exact phrases. If you want to learn about "social media" and don't want a bunch of results that include documents that include the word social and media - but are not about "social media," put the term in double quotes - "social media." This tells the search engine to find the exact phrase inside the quotes.
- Capitalization usually doesn't matter in search - except for Boolean operators.Searching for Dogs is the same as searching for dogs. But, searching for Dogs OR Cats is not the same as searching for Dogs or Cats. In the first case, you will find items referring either Dogs or Cats. In the second, you will most likely find content with both Dogs AND Cats in the content because "or" will be ignored and the default operator is AND.
- Use property searches if you know for sure that a particular word is in the title or name of a document. You can use filename:value to search for words in the file name or Title:value to search for a term in the Title. Note: if Title is blank, the Title:value syntax will also look for the value of the file name. If Title is not blank, this query will only look at content in the TItle. This syntax is helpful to know because sometimes, you know for sure that a word is in the name of a document but you can't remember the entire document name. Using this syntax works in SharePoint Foundation as well as "higher" versions of SharePoint. If you search for filename:festival, you will find any document with the term festival or festivals in the file name. Search appears to be interpreting this phrase as "filename contains the letters in festival." If you search for filename:festivals, you will only get documents where the exact term "festivals" is in the filename. In other words, "filename contains all of the letters in festivals." However, just to make things confusing, in SharePoint 2013, searching for filename:festival does NOT return documents where the plural term "festivals" is in the title. You can read more about this in the white paper because this is where things got really confusing and I'm hoping to get some more experts to explain why.
- Use a wildcard "*" if you want to be sure to get variations of the term you are looking for or if you are not sure about spelling. Out of the box with SharePoint 2010 search, stemming, the process of comparing the root forms of search terms to the content being searched is available but not turned on for most languages, including English. You can turn it on in the search results web part. I don't really know why it is disabled by default. Enabling stemming would allow a search for the word run to return values such as runs, ran, and running. Or, more importantly, a search for holiday to return company holidays. If stemming has not or can't be enabled in your environment, you can get similar - but not the exact same - results using a wildcard (the asterisk *). For example, you could type run* to get results that include runs and running. Or, type in holiday* to be sure you find company holidays. I would certainly work hard to get stemming turned on for search results - it is far more productive to return intuitive results than to make people remember my hints! But, if you can't make that happen, the wildcard search will help get better results. However, remember that there is a difference with wildcard versus stemming in search results. The run* search will not find results with the term "ran." I think Microsoft must have seen the light for this feature because in SharePoint 2013, stemming appears to be turned on by default.
- Try again. There are two search scenarios that I see over and over again when I'm watching people use their intranets. The first is that they search for something and get no results. "See," they tell me, "I told you search doesn't work. I search and I never get any results." The second is that they get too many results. "See," they tell me, "I told you search doesn't work. I search and I get too many results." While it is totally possible that search is having challenges because of a failure to observe hints 1, 2, and 3, it is also possible that your search needs to be re-written using different terms or a different approach. That's where hints 4 -10 come in. I know that it would be great if search just knew what we wanted without having to write better queries. I think that the time for this is not too far way. But, for now, it's often helpful to take another pass at writing the query differently using one of the approaches recommended in this post.