Skip to content

Commit

Permalink
Merge pull request #1002 from amvanbaren/remove-deprecated-search-props
Browse files Browse the repository at this point in the history
Remove deprecated search configuration properties
  • Loading branch information
amvanbaren authored Sep 30, 2024
2 parents 3c1f632 + 7d57129 commit f4b5687
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 39 deletions.
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

0 comments on commit f4b5687

Please sign in to comment.