Which code segment should you add at line 03?

You need to create a Web Part that displays all of the content created by a specific user.
You write the following code segment. (Line numbers are included for reference only.)

01 FullTextSqlQuery qry = new FullTextSqlQuery(ServerContext.GetContext(SPContext.Current.Site));
02 qry.ResultTypes = ResultType.RelevantResults;
03
04 qry.QueryText = strQuery;
05 ResultTableCollection results = qry.Execute();

Which code segment should you add at line 03?

You need to create a Web Part that displays all of the content created by a specific user.
You write the following code segment. (Line numbers are included for reference only.)

01 FullTextSqlQuery qry = new FullTextSqlQuery(ServerContext.GetContext(SPContext.Current.Site));
02 qry.ResultTypes = ResultType.RelevantResults;
03
04 qry.QueryText = strQuery;
05 ResultTableCollection results = qry.Execute();

Which code segment should you add at line 03?

A.
string strQuery = “author:” + searchAuthor;

B.
string strQuery = “docID:” + searchAuthor;

C.
string strQuery = “SELECT Title,Author,Path FROM SCOPE() WHERE author = ‘” + searchAuthor + “‘”;

D.
string strQuery = “SELECT Title,Creator,Path FROM SCOPE() WHERE docID = ‘” + searchAuthor + “‘”;

Explanation:
MNEMONIC RULE: “SQL to search for author”

FullTextSqlQuery: Use this class to execute SQL syntax search queries.

Windows SharePoint Services Search Query Object Model
http://msdn.microsoft.com/en-us/library/ms455094.aspx



Leave a Reply 0

Your email address will not be published. Required fields are marked *