From e3ebb0c5bb2e8ca9c2b12ce4f71522708f02cb1a Mon Sep 17 00:00:00 2001 From: Viktor Lofgren Date: Sat, 9 Dec 2023 16:39:46 +0100 Subject: [PATCH] (*) Rename the search filter 'RETRO' into 'POPULAR' This will make the terminology more consistent between the GUI and the code. The rankings yaml still uses 'retro' though, for to retain compatibility. --- .../model/query/SearchSetIdentifier.java | 2 +- .../nu/marginalia/api/ApiSearchOperator.java | 4 +--- .../marginalia/search/model/SearchFilters.java | 3 +-- .../marginalia/search/model/SearchProfile.java | 7 +++---- .../index/svc/IndexSearchSetsService.java | 18 +++++++++--------- 5 files changed, 15 insertions(+), 19 deletions(-) diff --git a/code/api/index-api/src/main/java/nu/marginalia/index/client/model/query/SearchSetIdentifier.java b/code/api/index-api/src/main/java/nu/marginalia/index/client/model/query/SearchSetIdentifier.java index e89d6d8b..4eb0eae0 100644 --- a/code/api/index-api/src/main/java/nu/marginalia/index/client/model/query/SearchSetIdentifier.java +++ b/code/api/index-api/src/main/java/nu/marginalia/index/client/model/query/SearchSetIdentifier.java @@ -7,7 +7,7 @@ package nu.marginalia.index.client.model.query; * */ public enum SearchSetIdentifier { NONE, - RETRO, + POPULAR, BLOGS, ACADEMIA, SMALLWEB diff --git a/code/services-application/api-service/src/main/java/nu/marginalia/api/ApiSearchOperator.java b/code/services-application/api-service/src/main/java/nu/marginalia/api/ApiSearchOperator.java index 7dca777c..f60a1750 100644 --- a/code/services-application/api-service/src/main/java/nu/marginalia/api/ApiSearchOperator.java +++ b/code/services-application/api-service/src/main/java/nu/marginalia/api/ApiSearchOperator.java @@ -10,8 +10,6 @@ import nu.marginalia.index.client.model.query.SearchSetIdentifier; import nu.marginalia.index.client.model.results.DecoratedSearchResultItem; import nu.marginalia.index.client.model.results.SearchResultKeywordScore; import nu.marginalia.index.query.limit.QueryLimits; -import nu.marginalia.index.query.limit.SpecificationLimit; -import nu.marginalia.index.searchset.SearchSet; import nu.marginalia.model.idx.WordMetadata; import nu.marginalia.query.client.QueryClient; import nu.marginalia.query.model.QueryParams; @@ -64,7 +62,7 @@ public class ApiSearchOperator { return switch (index) { case 0 -> SearchSetIdentifier.NONE; case 1 -> SearchSetIdentifier.SMALLWEB; - case 2 -> SearchSetIdentifier.RETRO; + case 2 -> SearchSetIdentifier.POPULAR; case 3 -> SearchSetIdentifier.NONE; case 5 -> SearchSetIdentifier.NONE; default -> SearchSetIdentifier.NONE; diff --git a/code/services-application/search-service/src/main/java/nu/marginalia/search/model/SearchFilters.java b/code/services-application/search-service/src/main/java/nu/marginalia/search/model/SearchFilters.java index 0ce79b31..3afdef7f 100644 --- a/code/services-application/search-service/src/main/java/nu/marginalia/search/model/SearchFilters.java +++ b/code/services-application/search-service/src/main/java/nu/marginalia/search/model/SearchFilters.java @@ -5,7 +5,6 @@ import nu.marginalia.WebsiteUrl; import nu.marginalia.search.command.SearchAdtechParameter; import nu.marginalia.search.command.SearchJsParameter; import nu.marginalia.search.command.SearchParameters; -import org.apache.regexp.RE; import java.util.List; @@ -37,7 +36,7 @@ public class SearchFilters { filterGroups = List.of( List.of( new Filter("No Filter", SearchProfile.NO_FILTER, parameters), - new Filter("Popular", SearchProfile.DEFAULT, parameters), + new Filter("Popular", SearchProfile.POPULAR, parameters), new Filter("Small Web", SearchProfile.SMALLWEB, parameters), new Filter("Blogosphere", SearchProfile.BLOGOSPHERE, parameters), new Filter("Academia", SearchProfile.ACADEMIA, parameters) diff --git a/code/services-application/search-service/src/main/java/nu/marginalia/search/model/SearchProfile.java b/code/services-application/search-service/src/main/java/nu/marginalia/search/model/SearchProfile.java index c1ed2c0b..97bf4d09 100644 --- a/code/services-application/search-service/src/main/java/nu/marginalia/search/model/SearchProfile.java +++ b/code/services-application/search-service/src/main/java/nu/marginalia/search/model/SearchProfile.java @@ -8,11 +8,10 @@ import nu.marginalia.index.client.model.query.SearchSetIdentifier; import java.util.Objects; public enum SearchProfile { - DEFAULT("default", SearchSetIdentifier.RETRO), + POPULAR("default", SearchSetIdentifier.POPULAR), SMALLWEB("modern", SearchSetIdentifier.SMALLWEB), BLOGOSPHERE("blogosphere", SearchSetIdentifier.BLOGS), NO_FILTER("corpo", SearchSetIdentifier.NONE), - YOLO("yolo", SearchSetIdentifier.NONE), VINTAGE("vintage", SearchSetIdentifier.NONE), TILDE("tilde", SearchSetIdentifier.NONE), CORPO_CLEAN("corpo-clean", SearchSetIdentifier.NONE), @@ -38,7 +37,7 @@ public enum SearchProfile { private final static SearchProfile[] values = values(); public static SearchProfile getSearchProfile(String param) { if (null == param) { - return DEFAULT; + return POPULAR; } for (var profile : values) { @@ -47,7 +46,7 @@ public enum SearchProfile { } } - return DEFAULT; + return POPULAR; } public void addTacitTerms(SearchSubquery subquery) { diff --git a/code/services-core/index-service/src/main/java/nu/marginalia/index/svc/IndexSearchSetsService.java b/code/services-core/index-service/src/main/java/nu/marginalia/index/svc/IndexSearchSetsService.java index 4c06bf2f..47dcf5b2 100644 --- a/code/services-core/index-service/src/main/java/nu/marginalia/index/svc/IndexSearchSetsService.java +++ b/code/services-core/index-service/src/main/java/nu/marginalia/index/svc/IndexSearchSetsService.java @@ -37,7 +37,7 @@ public class IndexSearchSetsService { // Below are binary indices that are used to constrain a search - private volatile RankingSearchSet retroSet; + private volatile RankingSearchSet popularSet; private volatile RankingSearchSet smallWebSet; private volatile RankingSearchSet academiaSet; private volatile RankingSearchSet blogsSet; @@ -72,7 +72,7 @@ public class IndexSearchSetsService { smallWebSet = new RankingSearchSet(SearchSetIdentifier.SMALLWEB, servicesFactory.getSearchSetsBase().resolve("small-web.dat")); academiaSet = new RankingSearchSet(SearchSetIdentifier.ACADEMIA, servicesFactory.getSearchSetsBase().resolve("academia.dat")); - retroSet = new RankingSearchSet(SearchSetIdentifier.RETRO, servicesFactory.getSearchSetsBase().resolve("retro.dat")); + popularSet = new RankingSearchSet(SearchSetIdentifier.POPULAR, servicesFactory.getSearchSetsBase().resolve("popular.dat")); blogsSet = new RankingSearchSet(SearchSetIdentifier.BLOGS, servicesFactory.getSearchSetsBase().resolve("blogs.dat")); } @@ -86,7 +86,7 @@ public class IndexSearchSetsService { } return switch (searchSetIdentifier) { case NONE -> anySet; - case RETRO -> retroSet; + case POPULAR -> popularSet; case ACADEMIA -> academiaSet; case SMALLWEB -> smallWebSet; case BLOGS -> blogsSet; @@ -95,7 +95,7 @@ public class IndexSearchSetsService { enum RepartitionSteps { UPDATE_ACADEMIA, - UPDATE_RETRO, + UPDATE_POPULAR, UPDATE_SMALL_WEB, UPDATE_BLOGS, UPDATE_RANKINGS, @@ -107,8 +107,8 @@ public class IndexSearchSetsService { processHeartbeat.progress(RepartitionSteps.UPDATE_ACADEMIA); updateAcademiaDomainsSet(); - processHeartbeat.progress(RepartitionSteps.UPDATE_RETRO); - updateRetroDomainsSet(); + processHeartbeat.progress(RepartitionSteps.UPDATE_POPULAR); + updatePopularDomainsSet(); processHeartbeat.progress(RepartitionSteps.UPDATE_SMALL_WEB); updateSmallWebDomainsSet(); @@ -139,15 +139,15 @@ public class IndexSearchSetsService { } @SneakyThrows - public void updateRetroDomainsSet() { + public void updatePopularDomainsSet() { var entry = rankingSettings.retro; var spr = new StandardPageRank(similarityDomains, entry.domains.toArray(String[]::new)); var data = spr.pageRankWithPeripheralNodes(entry.max, RankingResultHashSetAccumulator::new); synchronized (this) { - retroSet = new RankingSearchSet(SearchSetIdentifier.RETRO, retroSet.source, data); - retroSet.write(); + popularSet = new RankingSearchSet(SearchSetIdentifier.POPULAR, popularSet.source, data); + popularSet.write(); } }