我正在尝试实现SQL Server的语义搜索。要查看示例,我下载了AdventureWorks2012(“几乎”分步指南在这里:https://docs.microsoft.com/en-us/sql/relational-databases/search/find-similar-and-related-documents-with-semantic-search?view=sql-server-2017)。该错误表明必须声明@CandidateID和@MatchedID
我试图声明那些ID,而不是得到错误或结果却得到一个空表。
SELECT TOP(10) KEY_TBL.matched_document_key AS Candidate_ID
FROM SEMANTICSIMILARITYTABLE
(
HumanResources.JobCandidate,
Resume,
@CandidateID
) AS KEY_TBL
ORDER BY KEY_TBL.score DESC;
GO
SELECT TOP(5) KEY_TBL.keyphrase, KEY_TBL.score
FROM SEMANTICSIMILARITYDETAILSTABLE
(
HumanResources.JobCandidate,
Resume, @CandidateID,
Resume, @MatchedID
) AS KEY_TBL
ORDER BY KEY_TBL.score DESC;
GO
答案 0 :(得分:0)
您需要声明这些变量并分配值。只有您知道这些键的数据类型。例如:
declare @CandidateID int = 6754,
@MatchedID int = 4321
ID包含索引表中的真实ID。