Which code segment should you add at line 04?

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 private void keywordQueryExecute(string searchAuthor)
02 {
03 KeywordQuery kRequest = new KeywordQuery(ServerContext.Current);
04
05 kRequest.QueryText = strQuery;
06 ResultTableCollection resultTbls = kRequest.Execute();
07 }

Which code segment should you add at line 04?

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 private void keywordQueryExecute(string searchAuthor)
02 {
03 KeywordQuery kRequest = new KeywordQuery(ServerContext.Current);
04
05 kRequest.QueryText = strQuery;
06 ResultTableCollection resultTbls = kRequest.Execute();
07 }

Which code segment should you add at line 04?

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

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

C.
string strQuery = “SELECT Title, Rank, Write, Url FROM SCOPE() WHERE author = ” + searchAuthor;

D.
string strQuery = “SELECT Title, Rank, Write, Url FROM SCOPE() WHERE docID = ” + searchAuthor;

Explanation:
MNEMONIC RULE: “KeywordQuery = no SQL!”

Property Restriction Keyword Queries
http://msdn.microsoft.com/en-us/library/ff394509.aspx



Leave a Reply 0

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