Use links index for site suggestions.

This commit is contained in:
vlofgren 2022-08-24 03:45:04 +02:00
parent 54a24294b9
commit 4c8c8f5140

View File

@ -119,18 +119,17 @@ public class EdgeSearchOperator {
Set<EdgeDomain> resultDomains = queryResults.resultSet.stream().map(rs -> rs.url.domain).collect(Collectors.toSet()); Set<EdgeDomain> resultDomains = queryResults.resultSet.stream().map(rs -> rs.url.domain).collect(Collectors.toSet());
List<Integer> buckets = specs.buckets.stream().limit(specs.stagger ? 2 : 1).toList();
List<String> keywords = specs.subqueries.stream() List<String> keywords = specs.subqueries.stream()
.filter(sq -> sq.searchTermsExclude.isEmpty() && sq.searchTermsInclude.size() == 1) .filter(sq -> sq.searchTermsExclude.isEmpty() && sq.searchTermsInclude.size() == 1)
.map(sq -> sq.searchTermsInclude.get(0)) .map(sq -> sq.searchTermsInclude.get(0))
.distinct() .distinct()
.toList(); .toList();
List<EdgeDomainSearchSpecification> requests = new ArrayList<>(keywords.size() * buckets.size()); List<EdgeDomainSearchSpecification> requests = new ArrayList<>(keywords.size() * specs.buckets.size());
for (var keyword : keywords) { for (var keyword : keywords) {
for (var bucket : buckets) { for (var bucket : specs.buckets) {
requests.add(new EdgeDomainSearchSpecification(bucket, IndexBlock.TitleKeywords, keyword, requests.add(new EdgeDomainSearchSpecification(bucket, IndexBlock.Link, keyword,
1_000_000, 5, 25)); 1_000_000, 5, 25));
} }
} }