策展 API
「策展」特性是測試版特性。
使用策展來指定回應特定自然語言查詢的確切文件。 策展可以保證常見或重要的問題一律傳回最有價值的文件。 confidence_score 對於已編輯的查詢總是 1.00000。
此測試版功能僅可透過 API 使用,且僅適用於自然語言查詢,而非使用 Discovery Query Language 指定的查詢。 測試版功能無法從 SDK 取得。
您最多可以定義 1,000 個策展。 如需詳細資訊,請參閱 API 參考資料中的 建立策展。
此範例顯示如何使用 API 新增策展。 使用相同或類似的 natural_language_query 進行查詢時,將傳回 document_id 為 document_id1234 的文件。
{
"natural_language_query": "curations in watson discovery",
"curated_results": [
{
"document_id": "document_id1234",
"collection_id": "collection_id1234"
}
]
}
客戶提交的自然語言查詢必須與策展中指定的查詢完全匹配。 使用者在執行時提交的查詢,以及由 curation API 提交並儲存在索引中的查詢,都要經過查詢分析。 查詢分析器會對文字進行詞彙化,移除停滯字,並加入查詢擴充。
您可以選擇包含一個片段來指定對查詢的硬編碼回應。 片段是由您撰寫的回應,當針對指定的自然語言查詢傳回相關的文件時,就會傳回該回應。
{
"curations": [
{
"curation_id": "c1175536f509405bc68a9f76235fa7bbb6f9af2f",
"natural_language_query": "What is a project",
"curated_results": [
{
"collection_id": "47477591-b520-6039-0000-017ea213e837",
"document_id": "web_crawl_123a2a56-8c26-5acb-9544-c4702ac899a4",
"snippet": "A project is a convenient way to collect and manage the resources in your application. You can assign a project type and connect your data to the project by creating a collection."
}
]
}
]
}
If passages.per_document is true, the text snippet that you specify is returned as the top passage in the passage_text field instead of the original passage that is chosen by search. 每個文件只能指定一個文字片段。 If
passages.max_per_document is greater than 1, the snippet is returned first, followed by the passages that are chosen by search. 查詢篩選器會套用到策展結果。