Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove deprecated search configuration properties #1002

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,6 @@ public class ElasticSearchService implements ISearchService {
@Value("${ovsx.elasticsearch.clear-on-start:false}")
boolean clearOnStart;

@Value("${ovsx.elasticsearch.relevance.rating:1.0}")
double ratingRelevance;
@Value("${ovsx.elasticsearch.relevance.downloads:1.0}")
double downloadsRelevance;
@Value("${ovsx.elasticsearch.relevance.timestamp:1.0}")
double timestampRelevance;
@Value("${ovsx.elasticsearch.relevance.unverified:0.5}")
double unverifiedRelevance;

private Long maxResultWindow;

public ElasticSearchService(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import java.time.Duration;
import java.time.LocalDateTime;
import java.util.Optional;
Expand All @@ -48,39 +47,10 @@ public class RelevanceService {
@Value("${ovsx.search.relevance.deprecated:0.5}")
double deprecatedRelevance;

@Value("${ovsx.elasticsearch.relevance.rating:-1.0}")
double deprecatedElasticSearchRatingRelevance;
@Value("${ovsx.elasticsearch.relevance.downloads:-1.0}")
double deprecatedElasticSearchDownloadsRelevance;
@Value("${ovsx.elasticsearch.relevance.timestamp:-1.0}")
double deprecatedElasticSearchTimestampRelevance;
@Value("${ovsx.elasticsearch.relevance.unverified:-1.0}")
double deprecatedElasticSearchUnverifiedRelevance;

public RelevanceService(RepositoryService repositories) {
this.repositories = repositories;
}

@PostConstruct
void init() {
if (deprecatedElasticSearchRatingRelevance != -1.0) {
logger.warn("Using deprecated ovsx.elasticsearch.relevance.rating property. It has been renamed to ovsx.search.relevance.rating.");
this.ratingRelevance = deprecatedElasticSearchRatingRelevance;
}
if (deprecatedElasticSearchDownloadsRelevance != -1.0) {
logger.warn("Using deprecated ovsx.elasticsearch.relevance.downloads property. It has been renamed to ovsx.search.relevance.rating.");
this.downloadsRelevance = deprecatedElasticSearchDownloadsRelevance;
}
if (deprecatedElasticSearchTimestampRelevance != -1.0) {
logger.warn("Using deprecated ovsx.elasticsearch.relevance.timestamp property. It has been renamed to ovsx.search.relevance.rating.");
this.timestampRelevance = deprecatedElasticSearchTimestampRelevance;
}
if (deprecatedElasticSearchUnverifiedRelevance != -1.0) {
logger.warn("Using deprecated ovsx.elasticsearch.relevance.unverified property. It has been renamed to ovsx.search.relevance.rating.");
this.unverifiedRelevance = deprecatedElasticSearchUnverifiedRelevance;
}
}

public ExtensionSearch toSearchEntry(Extension extension, SearchStats stats) {
var latest = repositories.findLatestVersion(extension, null, false, true);
var targetPlatforms = repositories.findExtensionTargetPlatforms(extension);
Expand Down
Loading