Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have created a managed property TaskDueDate linked to ows_DueDate(Date and Time) which I would like to display in my search query results. However the query doesn't return any values for taskDueDate.

Any ideas how I can display my custom managed property? (It looks like the KeywordQuery has the SelectProperties.Add method to achieve this)

string currentUser = SPContext.Current.Web.CurrentUser.Name;
string searchQuery = "select title, path, priority, assignedto, TaskDueDate" +
              " from scope()" + "WHERE \"scope\"=\'All Tasks\'" + 
" and assignedto = '" + currentUser + "'";

FullTextSqlQuery query = new FullTextSqlQuery(SPContext.Current.Site);
query.ResultTypes = ResultType.RelevantResults;
query.QueryText = searchQuery;
ResultTableCollection results = query.Execute();
share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

You didn't mention it in your question so just to make sure...

Did you perform a Full Crawl of the content source AFTER you mapped the ows_DueDate crawled property to the TaskDueDate managed property?

Do you know for sure there is content with a value for the ows_DueDate crawled property?

SOLUTION:

The problem was due to teh fact that the FullTextQueriable parameter is by default set to false when you create custom search properties. After setting this parameter to 1 with PowerShell my FullTextSqlQuery returned the values for my custom search properties.

Set-SPEnterpriseSearchMetadataManagedproperty -Identity {you id of your custom property} -Searchapplication "Search Service Application" {In my case} -FullTextQueriable 1

share|improve this answer
    
- Full Crawl was done ok -There is content - Found out there is an attribute (fulltextqueriable) for managed properties which is set to null by default: msdn.microsoft.com/en-us/library/… –  Wim Hill Aug 11 '11 at 5:40
    
@Wim Hill: If that resolved your problem, please add it as the accepted solution. –  Stuart Pegg Aug 11 '11 at 7:10
1  
SOLUTION: The problem was due to teh fact that the FullTextQueriable parameter is by default set to false when you create custom search properties. After setting this parameter to 1 with PowerShell my FullTextSqlQuery returned the values for my custom search properties. Set-SPEnterpriseSearchMetadataManagedproperty -Identity {you id of your custom property} -Searchapplication "Search Service Application" {In my case} -FullTextQueriable 1 –  Wim Hill Aug 12 '11 at 9:00
    
Can you give me the exact code, I tried this, but am getting errors. Also how do I get the id of my managed metadata property? –  omega Jun 30 '13 at 21:37
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.