Skip to content
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
2 changes: 1 addition & 1 deletion server/src/dev/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ ovsx:
enabled: true
enforced: false
required: false
similarity-threshold: 0.2
similarity-threshold: 0.15
skip-if-publisher-verified: false
only-protect-verified-names: false
allow-similarity-to-own-names: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,11 @@
public class ExtensionJooqRepository {

private final DSLContext dsl;
private final ExtensionVersionJooqRepository extensionVersionRepo;

public ExtensionJooqRepository(DSLContext dsl) {
public ExtensionJooqRepository(DSLContext dsl, ExtensionVersionJooqRepository extensionVersionRepo) {
this.dsl = dsl;
this.extensionVersionRepo = extensionVersionRepo;
}

public List<Extension> findAllActiveById(Collection<Long> ids) {
Expand Down Expand Up @@ -405,10 +407,16 @@ public List<Extension> findSimilarExtensionsByLevenshtein(
maxDisplayNameDistance.cast(Integer.class)
);

var latestQuery = extensionVersionRepo.findLatestQuery(null, false, true);
latestQuery.addSelect(EXTENSION_VERSION.ID);
latestQuery.addConditions(EXTENSION_VERSION.EXTENSION_ID.eq(EXTENSION.ID));
var latestVersionId = latestQuery.asField().coerce(Long.class);

var displayNameSimilaritySubquery = DSL.selectOne()
.from(evLatest)
.where(evLatest.EXTENSION_ID.eq(EXTENSION.ID))
.and(evLatest.ACTIVE.eq(true))
.and(evLatest.ID.eq(latestVersionId))
.and(evLatest.DISPLAY_NAME.isNotNull())
.and(evLatest.DISPLAY_NAME.ne(""))
.and(DSL.length(evLatest.DISPLAY_NAME).between(minLen, lenMax))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1224,7 +1224,7 @@ public ExtensionVersion findLatestForAllUrls(
});
}

private SelectQuery<Record> findLatestQuery(
SelectQuery<Record> findLatestQuery(
String targetPlatform,
boolean onlyPreRelease,
boolean onlyActive
Expand Down