语言

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

要为其设置属性权重的架构类型。 此值不能为 null。

propertyPathWeights
IDictionary<String,Double>

架构类型的属性路径映射到要为该属性设置的权重。 此值不能为 null。

返回

特性

注解

按架构类型和属性路径设置属性权重。 属性权重用于在应用评分时提升和降级 GenericDocument 属性中的查询术语匹配项。 属性权重必须是正值(大于 0)。 属性的权重乘以该属性的评分贡献。 这意味着在属性内的术语匹配项中设置的权重介于 0.0 和 1.0 之间。 超过 1.0 的权重按属性中的术语匹配提升评分贡献。 AppSearchSchema 中存在但未显式设置权重的属性将为默认权重 1.0。 为 AppSearchSchema 中不存在的属性路径设置的权重将被丢弃,不会影响评分。 注意:属性权重仅影响查询相关评分策略(如SearchSpec.RANKING_STRATEGY_RELEVANCE_SCORE)的评分。

Android 参考。android.app.appsearch.SearchSpec.Builder.setPropertyWeights

本页的某些部分是根据 创建和共享的工作进行的修改,并根据 许可证中所述的条款使用。

适用于