語言

SearchSpec.Builder.SetPropertyWeights 方法

定義

依結構類型與屬性路徑設定屬性權重。

[Android.Runtime.Register("setPropertyWeights", "(Ljava/lang/String;Ljava/util/Map;)Landroid/app/appsearch/SearchSpec$Builder;", "", ApiSince=34)]
public Android.App.AppSearch.SearchSpec.Builder SetPropertyWeights(string schemaType, System.Collections.Generic.IDictionary<string,Java.Lang.Double> propertyPathWeights);
[<Android.Runtime.Register("setPropertyWeights", "(Ljava/lang/String;Ljava/util/Map;)Landroid/app/appsearch/SearchSpec$Builder;", "", ApiSince=34)>]
member this.SetPropertyWeights : string * System.Collections.Generic.IDictionary<string, Java.Lang.Double> -> Android.App.AppSearch.SearchSpec.Builder

參數

schemaType
String

用來設定屬性權重的結構型態。 這個值不可能為零值。

propertyPathWeights
IDictionary<String,Double>

一個將該模式類型屬性路徑映射到該屬性要設定的權重的映射。 這個值不可能為零值。

傳回

屬性

備註

依結構類型與屬性路徑設定屬性權重。 屬性權重用於在 GenericDocument 屬性中提升或降級查詢詞匹配,以套用評分。 屬性權重必須為正值(大於0)。 屬性的權重乘以該屬性的得分貢獻。 這表示權重設在0.0到1.0之間,會依據物業內的期限匹配降低貢獻。 權重設定在1.0以上,則有助於透過物業內的期限配對來評分貢獻。 AppSearchSchema 中存在但未明確設定權重的屬性,預設權重為 1.0。 AppSearchSchema 中不存在的屬性路徑權重將被捨棄,不影響評分。 注意:屬性權重僅影響查詢依賴的評分策略,如 SearchSpec.RANKING_STRATEGY_RELEVANCE_SCORE。

Android 參考資料。android.app.appsearch.SearchSpec.Builder.setPropertyWeights

本頁部分內容為基於 Open Source Project 所創建與分享的作品,並依授權條款所描述的使用進行修改。

適用於