Friday, January 16, 2015

Creating searchable custom Managed Properties. Part 1

One of the best things about SP is the Searching capabilities. Whenever people ask "what's so great about SP?" I always include Search in the answer somewhere.

Anyone can build a quick and dirty document management system and actually be able to FIND things with search.

This post is about putting in a little extra effect to search by some custom metadata you have on a list or library in spo365.

Scenario:

You create a new content type (create them in spo365 the same way as on-premise). You use this content type on several different sites. Let's say this content type is for projects in which your store the Customer and ProjectType.

You want to list all items with a certain Customer.

Solution:

Create a new managed property called MyCustomer (or whatever you like).
Throw a Content Search Web part on a page. Customize the query to use your new Managed Property.

Sounds easy, but there are some gotchas I learned. 

  1. You need to crawl your site before anything works
  2. Don't use dashes (-) in your Managed Property name even though it lets you. It just won't work in the CSWP. You can use a dash and create an alias that is only text chars though.


Step by Step

Create new Managed Property


  • Site Settings:Site Collection Administration: Search Schema
  • Click "New Managed Property"
  • Enter a name that only uses a-Z chars to make your life easier. For this exampe "MyCustomer"
  • You can only use Text or Yes/No. For others, reuse the "refinablNNN" props that already exist.
  • Click on Queryable and Retrievable
  • Enter an alias is you like.
  • Click the "Add a Mapping". 
  • This will open a form for you to search for your field. It will be prefixed with "ows_". Here is mine:












  • If you can't find your property, crawl your site. Instructions below.
  • Click OK to close the form then OK again.
  • Search for your new Managed Property! Here's mine:


  • You've now created the Managed Property that you can use in a Content Search Web Part. Nice!
To be continued in Part 2...

Welcome!

What is this blog about?


I'm starting this blog to document my journey into SharePoint o365 online. I'm not even sure what the proper name is. SharePoint online? SharePoint o365? I'll just be calling it SharePoint o365 or SPo365/spo365.

I'll try to write about differences I see between spo365 and on-premise if I happen to notice a difference.

I intend to take my career into more of a freelance spo365 guy. I think Microsoft is really pushing the cloud in a big way... and successfully. More and more companies will subscribe to Office 365 and discover they've got access to SharePoint and need someone to show them how to use it.

I've already used spo365 on a limited basis and am working on it currently, so I'm not exactly clueless. My goal is to post at least once a month. I'll try to post whenever I discover something useful.