SharePoint 2010 provides filtering of your search based on properties. and you can search for partial text as well(just entering few initial character)
Create your Query like :
QueryText = <property:queryText> OR title:<Your Search Keyword> OR fileextension:PDF
Sample Example :
KeywordQuery query = new KeywordQuery(proxy);
query.HiddenConstraints = "scope:\"<your Scope Name>\"";
query.ResultsProvider = Microsoft.Office.Server.Search.Query.SearchProvider.Default;
query.QueryText = "title:" + queryText;
query.ResultTypes |= ResultType.RelevantResults;
ResultTableCollection searchResults = query.Execute();
Create your Query like :
QueryText = <property:queryText> OR title:<Your Search Keyword> OR fileextension:PDF
Sample Example :
KeywordQuery query = new KeywordQuery(proxy);
query.HiddenConstraints = "scope:\"<your Scope Name>\"";
query.ResultsProvider = Microsoft.Office.Server.Search.Query.SearchProvider.Default;
query.QueryText = "title:" + queryText;
query.ResultTypes |= ResultType.RelevantResults;
ResultTableCollection searchResults = query.Execute();
No comments:
Post a Comment