Tuesday, February 23, 2016

SharePoint 2013 / SharePoint Online Search on custom columns

Requirement:
SharePoint Online search results should display results even if user typed keyword matches custom column value.

My Action:
I told business users, "Yes, we can do it". All were happy. Once I implemented the solution, I could not see the results. :( Very bad.

What I tried:
- I went to Site settings, under Site Collection Administration -> Search Schema
- I searched for managed properties which are created by SharePoint.
  ["SharePoint creates one when we create a column" - I believe so]
- In my case, I was looking for "Document Category" and it showed me  "DocumentCategoryOWSTXT"
- I edited that property and mapped my custom column
- Since it is SharePoint Online, I waited for one day to see the results.
- Next day i tried search items but no luck. Surprised !

I have went with so many alternate approaches but failed.

The Fix:
Suddenly I got an idea and i tried it. It Worked !!!!! :) Here's it;
1. Create new managed property and map the custom column
   - Go to Root level site settings
   - Look for "Search Schema" under Site Collection Administration and click it
   - Create a new managed property for the column you want to map it
      [In my case, I created "DocumentCategoryCustom" and selected the checkboxes of Searchable,     Queryable and Retrievable]
   - Map the custom column
     [In my case, I want to map the sub site's custom column "DocumentCategory". The column name was showing as "ows_DocumentCategory" in root level. I mapped it.]

2. Reindex Site
    - Go to Site settings
    - Look for "Search and Offline Availability" under Search
    - Click on Reindex Site

That's it !!!!!

[Later I came to know that this is a known issue and Microsoft's backend team is working on it. ]