hoc*_*cho 3 azure-cognitive-search
我在Azure搜索中有3套相同(以文本形式)的项目,这些项目因价格和积分而异。带有更高积分的便宜产品会被提升得更高。(价格比点数上涨得更多,反之亦然)。
但是,我一直看到与此类似的搜索结果。
搜索在“约翰·米尔顿”上。
我懂了
Product="Id = 2-462109171829-1, Price=116.57, Points= 7, Name=Life of Schamyl / John Milton Mackie, Description=.", Score=32.499783
Product="Id = 2-462109171829-2, Price=116.40, Points= 9, Name=Life of Schamyl / John Milton Mackie, Description=.", Score=32.454872
Product="Id = 2-462109171829-3, Price=115.64, Points= 9, Name=Life of Schamyl / John Milton Mackie, Description=.", Score=32.316270
Run Code Online (Sandbox Code Playgroud)
我希望评分顺序是这样的,首先是最低的价格。
Product="Id = 2-462109171829-3, Price=115.64, Points= 9, Name=Life of Schamyl / John Milton Mackie, Description=.", Score=
Product="Id = 2-462109171829-2, Price=116.40, Points= 9, Name=Life of Schamyl / John Milton Mackie, Description=.", Score=
Product="Id = 2-462109171829-1, Price=116.57, Points= 7, Name=Life of Schamyl / John Milton Mackie, Description=.", Score=
Run Code Online (Sandbox Code Playgroud)
我缺少什么或可接受小的计分方式?
索引定义为
let ProductDataIndex =
let fields =
[|
new Field (
"id",
DataType.String,
IsKey = true,
IsSearchable = true);
new Field (
"culture",
DataType.String,
IsSearchable = true);
new Field (
"gran",
DataType.String,
IsSearchable = true);
new Field (
"name",
DataType.String,
IsSearchable = true);
new Field (
"description",
DataType.String,
IsSearchable = true);
new Field (
"price",
DataType.Double,
IsSortable = true,
IsFilterable = true)
new Field (
"points",
DataType.Int32,
IsSortable = true,
IsFilterable = true)
|]
let weightsText =
new TextWeights(
Weights = ([|
("name", 4.);
("description", 2.)
|]
|> dict))
let priceBoost =
new MagnitudeScoringFunction(
new MagnitudeScoringParameters(
BoostingRangeStart = 1000.0,
BoostingRangeEnd = 0.0,
ShouldBoostBeyondRangeByConstant = true),
"price",
10.0)
let pointsBoost =
new MagnitudeScoringFunction(
new MagnitudeScoringParameters(
BoostingRangeStart = 0.0,
BoostingRangeEnd = 10000000.0,
ShouldBoostBeyondRangeByConstant = true),
"points",
2.0)
let scoringProfileMain =
new ScoringProfile (
"main",
TextWeights =
weightsText,
Functions =
new List<ScoringFunction>(
[
priceBoost :> ScoringFunction
pointsBoost :> ScoringFunction
]),
FunctionAggregation =
ScoringFunctionAggregation.Sum)
new Index
(Name = ProductIndexName
,Fields = fields
,ScoringProfiles = new List<ScoringProfile>(
[
scoringProfileMain
]))
Run Code Online (Sandbox Code Playgroud)
Azure搜索中的所有索引都分为多个碎片,使我们能够快速扩展和缩减。发出搜索请求时,将针对每个分片单独发出搜索请求。然后,将每个分片的结果集合并并按分数排序(如果未定义其他排序)。重要的是要知道,评分函数将每个文档中的查询词频度与所有文档中的频度(分片)进行加权!
这意味着在您的方案中,即使禁用了评分配置文件,每个文档都有三个实例,如果其中一个文档位于与其他两个文档不同的分片上,其得分将略有不同。索引中的数据越多,差异将越小(术语分布越均匀)。不能假设任何给定文档将放置在哪个分片上。
通常,文档分数不是订购文档的最佳属性。它只应使您对结果集中的文档与其他文档具有相关性的一般认识。在您的方案中,如果您将价格和/或积分字段标记为可排序,则可以按价格和/或积分对结果进行排序。您可以在此处找到有关如何使用$ orderby查询参数的更多信息:https : //msdn.microsoft.com/zh-cn/library/azure/dn798927.aspx
| 归档时间: |
|
| 查看次数: |
1453 次 |
| 最近记录: |