Skip to content
This repository has been archived by the owner on Jul 30, 2024. It is now read-only.
/ NuGet.Jobs Public archive

Commit

Permalink
Remove the freshness boost (#590)
Browse files Browse the repository at this point in the history
  • Loading branch information
loic-sharma authored Jul 22, 2019
1 parent b213375 commit 465245a
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,5 @@ public class AzureSearchScoringConfiguration
/// This boosts packages with many downloads.
/// </summary>
public double DownloadScoreBoost { get; set; }

/// <summary>
/// The <see cref="BaseMetadataDocument.Published"/> freshness boost.
/// This boosts packages that were published recently.
/// </summary>
public double PublishedFreshnessBoost { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,6 @@ public static ScoringProfile Create(AzureSearchScoringConfiguration config)
throw new ArgumentOutOfRangeException(nameof(config.DownloadScoreBoost));
}

if (config.PublishedFreshnessBoost <= 1)
{
throw new ArgumentOutOfRangeException(nameof(config.PublishedFreshnessBoost));
}

if (config.FieldWeights.Count != 0)
{
var unknownField = config
Expand Down Expand Up @@ -88,14 +83,6 @@ public static ScoringProfile Create(AzureSearchScoringConfiguration config)
boostingRangeEnd: DocumentUtilities.GetDownloadScore(999_999_999_999),
shouldBoostBeyondRangeByConstant: true),
interpolation: ScoringFunctionInterpolation.Linear),

// Boost results with a recent published date. We use a quadatric interpolation
// so that the boost decreases faster as the publish date nears the end of the boost range.
new FreshnessScoringFunction(
fieldName: IndexFields.Published,
boost: config.PublishedFreshnessBoost,
boostingDuration: TimeSpan.FromDays(365),
interpolation: ScoringFunctionInterpolation.Quadratic),
},

// The scores of each Scoring Function should be summed together before multiplying the base relevance scores.
Expand Down
10 changes: 1 addition & 9 deletions tests/NuGet.Services.AzureSearch.Tests/IndexBuilderFacts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -241,21 +241,14 @@ public async Task CreatesScoringProfile()
Assert.Equal(4.0, result.TextWeights.Weights[IndexFields.TokenizedPackageId]);

// Verify boosting functions
Assert.Equal(2, result.Functions.Count);
Assert.Equal(1, result.Functions.Count);
var downloadsBoost = result
.Functions
.Where(f => f.FieldName == IndexFields.Search.DownloadScore)
.FirstOrDefault();
var freshnessBoost = result
.Functions
.Where(f => f.FieldName == IndexFields.Published)
.FirstOrDefault();

Assert.NotNull(downloadsBoost);
Assert.Equal(5.0, downloadsBoost.Boost);

Assert.NotNull(freshnessBoost);
Assert.Equal(6.0, freshnessBoost.Boost);
}

[Fact]
Expand Down Expand Up @@ -484,7 +477,6 @@ public BaseFacts(ITestOutputHelper output)
},

DownloadScoreBoost = 5.0,
PublishedFreshnessBoost = 6.0
}
};
_logger = output.GetLogger<IndexBuilder>();
Expand Down

0 comments on commit 465245a

Please sign in to comment.