I have a managed property defined called "LoanCategory" and I am trying to set up a search scope for this managed property.

I was able to set up the scope to use the content type of "Loan Category" which is my managed property however it asks me to set it equal to something. For example "Loan Category" = "Legal". That is fine if I want to search for items in the Loan Category of "Legal" however if I want to return all items similar to doing a search for the managed property "LoanCategory:Legal".

So Ideally they could type the category in the search box with "LoanCategory" defined as the scope.

I have tried using content type loancategory = a blank however that does not produce the desired effect.

1 Answer 1


You set the scope against the "contentclass" not a property itself. You then restrict the search down to that content type, and then you query on that single field in your search method be it a search webpart or a code behind query.

To see how this works look at the "People Scope" which implements this already.

So your query then would become:

scope:CustomScope LoanCategory:Legal

and you return the selected properties you require (c# example as it's what I use)

SearchServiceApplicationProxy proxy = (SearchServiceApplicationProxy)SearchServiceApplicationProxy.GetProxy(SPServiceContext.GetContext(SPContext.Current.Site));
KeywordQuery query = new KeywordQuery(proxy);
query.ResultsProvider = Microsoft.Office.Server.Search.Query.SearchProvider.Default;

query.QueryText = "scope:CustomScope LoanCategory:Legal";

// I recommend paging!
// query.RowLimit = 10;
// query.StartRow = cursor;

query.ResultTypes |= ResultType.RelevantResults;

ResultTableCollection searchResults = query.Execute();

if (searchResults.Exists(ResultType.RelevantResults))
    ResultTable resultTable = searchResults[ResultType.RelevantResults];

    DataTable resultsDataTable = new DataTable();
    resultsDataTable .TableName = "Results";
    resultsDataTable .Load(resultTable, LoadOption.OverwriteChanges);

    foreach (DataRow data in result.Rows)
        // Read the data here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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