semanticsimilaritydetailstable (Transact-SQL)
Returns a table of zero, one, or more rows of key phrases that are common across two documents (a source document and a matched document) whose content is semantically similar.
This rowset function can be referenced in the FROM clause of a SELECT statement like a regular table name.
The following table describes the information about key phrases that this rowset function returns.
|
Column_name |
Type |
Description |
|---|---|---|
|
keyphrase |
NVARCHAR |
The key phrase that contributes to the similarity between source document and the matched document. |
|
score |
REAL |
A relative value for this key phrase in its relationship to all the other key phrases that are similar between the 2 documents. The value is a fractional decimal value in the range of [0.0, 1.0] where a higher score represents a higher weighting and 1.0 is the perfect score. |
For more information, see Find Similar and Related Documents with Semantic Search.
The following example retrieves the 5 key phrases that had the highest similarity score between the specified candidates in HumanResources.JobCandidate table of the AdventureWorks2012 sample database. The @CandidateId and @MatchedID variables represent values from the key column of the full-text index.
SELECT TOP(5) KEY_TBL.keyphrase, KEY_TBL.score FROMSEMANTICSIMILARITYDETAILSTABLE ( HumanResources.JobCandidate, Resume, @CandidateID, Resume, @MatchedID ) AS KEY_TBL ORDER BY KEY_TBL.score DESC;