Skip to content

Commit

Permalink
Merge #407
Browse files Browse the repository at this point in the history
407: fix: rename current_mean and current_sigma r=curquiza a=ahmednfwela

# Pull Request

## Related issue
as discussed on discord, the openapi file incorrectly contains `current_sigma` and `current_mean` when they should just be `sigma` and `mean`

## What does this PR do?
fixes #398

## PR checklist
Please check if your PR fulfills the following requirements:
- [ ] Does this PR fix an existing issue, or have you listed the changes applied in the PR description (and why they are needed)?
- [ ] Have you read the contributing guidelines?
- [ ] Have you made sure that the title is accurate and descriptive of the changes?

Thank you so much for contributing to Meilisearch!


Co-authored-by: ahmednfwela <[email protected]>
  • Loading branch information
meili-bors[bot] and ahmednfwela authored Jan 15, 2025
2 parents be0ecb9 + 5480f79 commit dca48cd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
16 changes: 8 additions & 8 deletions lib/src/settings/distribution.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,27 @@
class DistributionShift {
/// Value where the results are "packed".
/// Similarity scores are translated so that they are packed around 0.5 instead
final double currentMean;
final double mean;

/// standard deviation of a similarity score.
///
/// Set below 0.4 to make the results less packed around the mean, and above 0.4 to make them more packed.
final double currentSigma;
final double sigma;

DistributionShift({
required this.currentMean,
required this.currentSigma,
required this.mean,
required this.sigma,
});

factory DistributionShift.fromMap(Map<String, Object?> map) {
return DistributionShift(
currentMean: map['current_mean'] as double,
currentSigma: map['current_sigma'] as double,
mean: map['mean'] as double,
sigma: map['sigma'] as double,
);
}

Map<String, Object?> toMap() => {
'current_mean': currentMean,
'current_sigma': currentSigma,
'mean': mean,
'sigma': sigma,
};
}
12 changes: 6 additions & 6 deletions test/search_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -604,8 +604,8 @@ void main() {
binaryQuantized: true,
dimensions: 100,
distribution: DistributionShift(
currentMean: 20,
currentSigma: 5,
mean: 20,
sigma: 5,
),
url: 'https://example.com',
documentTemplateMaxBytes: 200,
Expand All @@ -619,8 +619,8 @@ void main() {
'documentTemplate': 'a book titled {{ doc.title }}',
'dimensions': 100,
'distribution': {
'current_mean': 20,
'current_sigma': 5,
'mean': 20,
'sigma': 5,
},
'url': 'https://example.com',
'documentTemplateMaxBytes': 200,
Expand All @@ -635,8 +635,8 @@ void main() {
expect(
deserialized.documentTemplate, 'a book titled {{ doc.title }}');
expect(deserialized.dimensions, 100);
expect(deserialized.distribution?.currentMean, 20);
expect(deserialized.distribution?.currentSigma, 5);
expect(deserialized.distribution?.mean, 20);
expect(deserialized.distribution?.sigma, 5);
expect(deserialized.url, 'https://example.com');
expect(deserialized.documentTemplateMaxBytes, 200);
expect(deserialized.binaryQuantized, true);
Expand Down

0 comments on commit dca48cd

Please sign in to comment.