Querying Full-Text Data in Microsoft SQL Server 2012

  • 12/15/2012

Answers

This section contains answers to the lesson review questions and solutions to the case scenarios in this chapter.

Lesson 1

  1. Correct Answers: A and D

    1. Correct: Stopwords include noisy words.

    2. Incorrect: Thesaurus is used for synonyms.

    3. Incorrect: Stemmer is used for generating inflectional forms of words.

    4. Correct: You group stopwords in stoplists.

  2. Correct Answer: C

    1. Incorrect: The msdb database is installed by default and is used for SQL Server Agent.

    2. Incorrect: The distribution database is installed and used by replication.

    3. Correct: You need the semanticsdb database in order to enable semantic search.

    4. Incorrect: The tempdb database is installed by default and is used for all temporary objects.

  3. Correct Answer: A

    1. Correct: You can add synonyms by editing the thesaurus file.

    2. Incorrect: Full-text search uses thesaurus files and not tables for synonyms.

    3. Incorrect: You cannot use stopwords for synonyms.

    4. Incorrect: Full-text search supports synonyms.

Lesson 2

  1. Correct Answer: E

    1. Incorrect: FORMSOF is a valid keyword of the CONTAINS predicate.

    2. Incorrect: THESAURUS is a valid keyword.

    3. Incorrect: NEAR is a valid keyword.

    4. Incorrect: PROPERTY is a valid keyword.

    5. Correct: TEMPORARY is not a valid keyword of the CONTAINS predicate.

  2. Correct Answer: A

    1. Correct: This proximity term defines both distance and order of searched terms.

    2. Incorrect: This is not a valid syntax.

    3. Incorrect: This proximity term defines distance of searched terms only.

    4. Incorrect: This proximity term does not define either distance or order of searched terms.

  3. Correct Answers: A, B, D, and E

    1. Correct: You can search for inflectional forms of a word.

    2. Correct: You can search for synonyms of a searched word.

    3. Incorrect: Full-text search does not support translations.

    4. Correct: You can search for text in which a search word is close to another search word.

    5. Correct: You can search for a prefix of a word or a phrase only.

Lesson 3

  1. Correct Answer: A

    1. Correct: You use the CONTAINSTABLE function to rank documents based on proximity of words.

    2. Incorrect: You use the FREETEXTTABLE function to rank documents based on containment of words.

    3. Incorrect: You use the SEMANTICKEYPHRASETABLE function to return key phrases associated with the full-text indexed column.

    4. Incorrect: You use the SEMANTICSIMILARITYTABLE function to retrieve documents scored by similarity to a specified document.

    5. Incorrect: You use the SEMANTICSIMILARITYDETAILSTABLE function to return key phrases that are common across two documents.

  2. Correct Answer: D

    1. Incorrect: You use the CONTAINSTABLE function to rank documents based on proximity of words.

    2. Incorrect: You use the FREETEXTTABLE function to rank documents based on containment of words.

    3. Incorrect: You use the SEMANTICKEYPHRASETABLE function to return key phrases associated with the full-text indexed column.

    4. Correct: You use the SEMANTICSIMILARITYTABLE function to retrieve documents scored by similarity to a specified document.

    5. Incorrect: You use the SEMANTICSIMILARITYDETAILSTABLE function to return key phrases that are common across two documents.

  3. Correct Answer: C

    1. Incorrect: You use the CONTAINSTABLE function to rank documents based on proximity of words.

    2. Incorrect: You use the FREETEXTTABLE function to rank documents based on containment of words.

    3. Correct: You use the SEMANTICKEYPHRASETABLE function to return key phrases associated with the full-text indexed column.

    4. Incorrect: You use the SEMANTICSIMILARITYTABLE function to retrieve documents scored by similarity to a specified document.

    5. Incorrect: You use the SEMANTICSIMILARITYDETAILSTABLE function to return key phrases that are common across two documents.

Case Scenario 1

  1. You should use the Full-Text Search feature of SQL Server.

  2. You should revise your queries to include the full-text predicates, or use the full-text and semantic search table-valued functions.

Case Scenario 2

  1. A T-SQL solution is simpler in this scenario because the SQL Server Full-Text Search and Semantic Search features support the functionality you need out of the box.

  2. You should use the SEMANTICSIMILARITYTABLE function.