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.
- You need to crawl your site before anything works
- 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...
No comments:
Post a Comment