In the following code of a web part that was doing a custom KeywordQuery search, I received the error “Property doesn’t exist or is used in a manner inconsistent with schema settings.” The Properties that I was adding to the KeywordQuery had not yet been mapped in the Search Service Application, Metadata Properties:
//Get associated search service application SearchServiceApplicationProxy proxy = (SearchServiceApplicationProxy)SearchServiceApplicationProxy.GetProxy (SPServiceContext.GetContext(SPContext.Current.Site)); //Use Keyword Query Microsoft.Office.Server.Search.Query.KeywordQuery keywordQuery = new Microsoft.Office.Server.Search.Query.KeywordQuery(proxy); keywordQuery.ResultsProvider = Microsoft.Office.Server.Search.Query.SearchProvider.Default; //Return following properties keywordQuery.SelectProperties.Add("ProjectCreator"); keywordQuery.SelectProperties.Add("ProjectName"); keywordQuery.SelectProperties.Add("ProjectDescription"); keywordQuery.SelectProperties.Add("ProjectStage"); keywordQuery.SelectProperties.Add("Path"); keywordQuery.SelectProperties.Add("Title"); keywordQuery.SelectProperties.Add("Id"); keywordQuery.SelectProperties.Add("SiteName");
To map these properties, go to the Search Service Application –> Metadata Properties page in Central Administration –> Application Management.
Select “New Managed Property”
Type the new Managed Property and add a mapping
In my case, I am mapping to properties that were promoted from an InfoPath form.
Once the property is mapped, re-run an incremental or full crawl on your content source which contains the property