theme-sticky-logo-alt

Hyphen, underscore or space? Which one is the best for SharePoint Search?

20 Comments

I was at a client today and I got a very interesting question about how should users name their files. There were many rumors that underscores were the best, since SharePoint knows to split the words up after an underscore. I didn’t have an immediate answer about it, but let’s test it out!

I have uploaded three files to SharePoint with content that makes no sense, so the search only searches on the title of the file. Here are the names of the three files:

  • Vlad is the best SharePoint Administrator ever
  • Vlad_is_the_best_SharePoint_Administrator_Ever
  • vlad-is-the-best-sharepoint-administrator-ever

 

So, after 30 minutes, I decided to search “SharePoint Administrator” without the quotes! Here is the result:

best SharePoint Search

As you can see, all 3 results have been returned, however the only difference is that SharePoint was able to find the two words in the URL as well for the “Space” and “underscore” options!

Now let’s try with quotes around “SharePoint Administrator”. We can see that the results are similar to the one before, however only the result with a space was bolded by SharePoint. SharePoint found the word with a space in the URL, even if there was a space or underscore.

best for SharePoint Search

However, if we search for “SharePoint_Administrator” without the quotes, we only get the one that actually has the underscores in the title name!

However, I have never seen anyone actually use underscores when doing a search. But if your users do it, it’s a good to know!

Conclusion

After testing, I believe that spaces are the best option for your filenames, but if you really don’t want to use spaces in your filenames, use underscores! Never use hyphens!

 

Leave  a comment and don’t forget to like the Absolute SharePoint Blog Page on Facebook and to follow me on Twitter here  for the latest news and technical articles on SharePoint.  Also, don’t forget to check out SharePoint Community.Net for more great SharePoint Content.

Previous Post
Change in the SharePoint 2013 MCSE Certifications
Next Post
New CodePlex Version: SharePoint Host Named Site Collection Creator

20 Comments

  • September 9, 2014 at 11:53 am

    Did the time you uploaded these 3 files play into the ranking and results? It seems like it would. Could you share the time stamps or order you uploaded these? I agree spaces should be best.

    Reply
    • September 12, 2014 at 12:45 pm

      Hey Joel!

      All 3 of them were uploaded at the same time, so timing didn’t make a difference!

      Reply
  • September 10, 2014 at 2:04 pm
    Christophe

    Good to know, thanks for sharing!

    Reply
  • September 13, 2014 at 10:46 am
    Elaine Raffertu

    Hey Vlad, leaving the space adds the three extra characters into the URL for each space, correct? So if you are concerned with reaching that maximum 255 character length of the URL, it would be best to use the underscores. Would you agree with that statement? On my department’s intranet site (SharePoint publishing platform), I have been removing spaces from file names whenever I find them for that reason. Our site was built in the traditional sub-site architecture rather than across one level, and the number of characters in the URL is very important. It has impacted us with retreiving site metrics from Adobe reporting and analysis (Site Catalyst). Thanks!

    Reply
    • September 25, 2014 at 1:03 am

      Hello,

      As many people on the comments said, and I agree with them, it may cause problem with the URL Length. However, since you’re not supposed to use folders in SharePoint, but more metadata, you shouldn’t reach the 256 characters that easy!

      If you use a lot of folders or a lot of subsites, I agree that underscores would be the best option!

      Reply
  • September 22, 2014 at 3:53 am

    What about the issue with the url string not exceeding 256 character? i’ve been to that once a url string exceeds 256 characters SharePoint begims to experience degradation. for example if you are in a site and your url path is /sites/People%20Places%20and%20Administration/Employee%20Communications%20Team/This%20is%20a%20long%20filename.docx couldn’t doing your recommendation become problematic?

    Reply
    • September 25, 2014 at 1:03 am

      Hello,

      As many people on the comments said, and I agree with them, it may cause problem with the URL Length. However, since you’re not supposed to use folders in SharePoint, but more metadata, you shouldn’t reach the 256 characters that easy!

      If you use a lot of folders or a lot of subsites, I agree that underscores would be the best option!

      Reply
  • September 26, 2014 at 3:36 pm
    Sam

    Hi,

    Again, just like others, spaces add the special encoded chars in the URL; adding to the length of the URL but also making the URLs look ugly too for sharing etc. when applicable.

    Why do _ and – not work in the same way, is there a way to configure this somewhere may be?

    Also, no matter how much metadata you use, a big intranet/collaboration setup will have few levels if not many, and spaces will make if look totally unacceptable almost?

    Thanks

    Reply
  • September 26, 2014 at 4:19 pm
    Sam

    Also, the key is that SP recognises the -hyphen and hence searches for those words entered in the search, even if they are typed separately. You could still search for SharePoint or Administrator, and SP would list the file with -hyphens in it too.

    The bold text is via the use of XSLT as per my understanding so a bit of tinkering should do the job I’d imagine.

    Will be good to hear what others think and their views ?

    Reply
  • October 1, 2014 at 10:10 am
    John

    We are crawling File Shares as well so does the recommendation hold there as well?

    Reply
  • November 11, 2014 at 7:59 am
    Michael

    Why isn’t camel case one of the options considered?

    Reply
    • December 2, 2014 at 11:21 pm

      Didn’t think of it and I haven’t seen it as a popular options in my clients. Do you have a lot of clients that use camel case as a naming convention?

      Reply
  • June 3, 2015 at 12:50 pm
    Bob

    Nice post Vlad!

    Reply
  • June 4, 2015 at 8:44 pm
    Not Jeff

    I am concerned with the issue of me just learning I am not the best SharePoint administrator in the world…. Other than that, nice post.

    Reply
  • May 27, 2017 at 11:39 am
    T

    Did you try just searching for one word (as opposed to two words — SharePoint Administrator) like either SharePoint or just Administrator?
    I have observed, when using Two or more words, results are correct… But if using just one word as keyword, then results are not correct. Any pointers?

    Reply
  • May 31, 2018 at 3:11 pm
    Jim

    What about comparing to VladisthebestSharePointAdministratorever?

    Reply
  • September 18, 2019 at 12:06 pm
    Raz

    I think the post just proves what is best **given the quality of the sharepoint search indexing** which may be improved…
    Cheers

    Reply
  • November 1, 2019 at 3:45 pm
    Eva

    Does this also apply to TEAMS?

    Reply

Leave a Reply

15 49.0138 8.38624 1 0 4000 1 https://vladtalkstech.com 300 1