mirror of
https://github.com/MarginaliaSearch/MarginaliaSearch.git
synced 2025-10-06 07:32:38 +02:00
Compare commits
5 Commits
deploy-004
...
deploy-004
Author | SHA1 | Date | |
---|---|---|---|
|
79da622e3b | ||
|
3da8337ba6 | ||
|
a32d230f0a | ||
|
3772bfd387 | ||
|
02a7900d1a |
@@ -29,6 +29,7 @@ dependencies {
|
||||
implementation libs.jsoup
|
||||
implementation project(':third-party:rssreader')
|
||||
implementation libs.opencsv
|
||||
implementation libs.slop
|
||||
implementation libs.sqlite
|
||||
implementation libs.bundles.slf4j
|
||||
implementation libs.commons.lang3
|
||||
|
@@ -96,6 +96,7 @@ public class FeedFetcherService {
|
||||
throw new IllegalStateException("Already updating feeds, refusing to start another update");
|
||||
}
|
||||
|
||||
|
||||
try (FeedDbWriter writer = feedDb.createWriter();
|
||||
HttpClient client = HttpClient.newBuilder()
|
||||
.connectTimeout(Duration.ofSeconds(15))
|
||||
@@ -103,6 +104,7 @@ public class FeedFetcherService {
|
||||
.followRedirects(HttpClient.Redirect.NORMAL)
|
||||
.version(HttpClient.Version.HTTP_2)
|
||||
.build();
|
||||
FeedJournal feedJournal = FeedJournal.create();
|
||||
var heartbeat = serviceHeartbeat.createServiceAdHocTaskHeartbeat("Update Rss Feeds")
|
||||
) {
|
||||
updating = true;
|
||||
@@ -155,6 +157,8 @@ public class FeedFetcherService {
|
||||
case FetchResult.Success(String value, String etag) -> {
|
||||
writer.saveEtag(feed.domain(), etag);
|
||||
writer.saveFeed(parseFeed(value, feed));
|
||||
|
||||
feedJournal.record(feed.feedUrl(), value);
|
||||
}
|
||||
case FetchResult.NotModified() -> {
|
||||
writer.saveEtag(feed.domain(), ifNoneMatchTag);
|
||||
|
@@ -0,0 +1,64 @@
|
||||
package nu.marginalia.rss.svc;
|
||||
|
||||
import nu.marginalia.WmsaHome;
|
||||
import nu.marginalia.slop.SlopTable;
|
||||
import nu.marginalia.slop.column.string.StringColumn;
|
||||
import nu.marginalia.slop.desc.StorageType;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
|
||||
/** Utility for recording fetched feeds to a journal, useful in debugging feed parser issues.
|
||||
*/
|
||||
public interface FeedJournal extends AutoCloseable {
|
||||
StringColumn urlColumn = new StringColumn("url");
|
||||
StringColumn contentsColumn = new StringColumn("contents", StandardCharsets.UTF_8, StorageType.ZSTD);
|
||||
|
||||
void record(String url, String contents) throws IOException;
|
||||
void close() throws IOException;
|
||||
|
||||
|
||||
static FeedJournal create() throws IOException {
|
||||
if (Boolean.getBoolean("feedFetcher.persistJournal")) {
|
||||
Path journalPath = WmsaHome.getDataPath().resolve("feed-journal");
|
||||
if (Files.isDirectory(journalPath)) {
|
||||
FileUtils.deleteDirectory(journalPath.toFile());
|
||||
}
|
||||
Files.createDirectories(journalPath);
|
||||
return new RecordingFeedJournal(journalPath);
|
||||
}
|
||||
else {
|
||||
return new NoOpFeedJournal();
|
||||
}
|
||||
}
|
||||
|
||||
class NoOpFeedJournal implements FeedJournal {
|
||||
@Override
|
||||
public void record(String url, String contents) {}
|
||||
|
||||
@Override
|
||||
public void close() {}
|
||||
}
|
||||
|
||||
class RecordingFeedJournal extends SlopTable implements FeedJournal {
|
||||
|
||||
private final StringColumn.Writer urlWriter;
|
||||
private final StringColumn.Writer contentsWriter;
|
||||
|
||||
public RecordingFeedJournal(Path path) throws IOException {
|
||||
super(path, SlopTable.getNumPages(path, FeedJournal.urlColumn));
|
||||
|
||||
urlWriter = urlColumn.create(this);
|
||||
contentsWriter = contentsColumn.create(this);
|
||||
}
|
||||
|
||||
public synchronized void record(String url, String contents) throws IOException {
|
||||
urlWriter.put(url);
|
||||
contentsWriter.put(contents);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@@ -15,7 +15,10 @@ import nu.marginalia.api.searchquery.model.results.debug.ResultRankingDetails;
|
||||
import nu.marginalia.index.query.limit.QueryStrategy;
|
||||
import nu.marginalia.model.EdgeUrl;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class QueryProtobufCodec {
|
||||
|
||||
@@ -42,13 +45,27 @@ public class QueryProtobufCodec {
|
||||
else
|
||||
builder.setQueryStrategy(request.getQueryStrategy());
|
||||
|
||||
if (query.specs.rankingParams != null && request.getTemporalBias().getBias() != RpcTemporalBias.Bias.NONE) {
|
||||
builder.setParameters(
|
||||
RpcResultRankingParameters.newBuilder(query.specs.rankingParams)
|
||||
.setTemporalBias(request.getTemporalBias())
|
||||
.build()
|
||||
);
|
||||
if (request.getTemporalBias().getBias() != RpcTemporalBias.Bias.NONE) {
|
||||
if (query.specs.rankingParams != null) {
|
||||
builder.setParameters(
|
||||
RpcResultRankingParameters.newBuilder(query.specs.rankingParams)
|
||||
.setTemporalBias(request.getTemporalBias())
|
||||
.build()
|
||||
);
|
||||
} else {
|
||||
builder.setParameters(
|
||||
RpcResultRankingParameters.newBuilder(PrototypeRankingParameters.sensibleDefaults())
|
||||
.setTemporalBias(request.getTemporalBias())
|
||||
.build()
|
||||
);
|
||||
}
|
||||
} else if (query.specs.rankingParams != null) {
|
||||
builder.setParameters(query.specs.rankingParams);
|
||||
}
|
||||
// else {
|
||||
// if we have no ranking params, we don't need to set them, the client check and use the default values
|
||||
// so we don't need to send this huge object over the wire
|
||||
// }
|
||||
|
||||
return builder.build();
|
||||
}
|
||||
@@ -292,7 +309,7 @@ public class QueryProtobufCodec {
|
||||
IndexProtobufCodec.convertSpecLimit(specs.getRank()),
|
||||
specs.getQueryLimits(),
|
||||
QueryStrategy.valueOf(specs.getQueryStrategy()),
|
||||
Objects.requireNonNullElseGet(specs.getParameters(), PrototypeRankingParameters::sensibleDefaults)
|
||||
specs.hasParameters() ? specs.getParameters() : null
|
||||
);
|
||||
}
|
||||
|
||||
|
@@ -5,6 +5,7 @@ import nu.marginalia.api.searchquery.RpcResultRankingParameters;
|
||||
import nu.marginalia.index.query.limit.QueryStrategy;
|
||||
import nu.marginalia.index.query.limit.SpecificationLimit;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
|
||||
public class SearchSpecification {
|
||||
@@ -28,6 +29,7 @@ public class SearchSpecification {
|
||||
|
||||
public final QueryStrategy queryStrategy;
|
||||
|
||||
@Nullable
|
||||
public final RpcResultRankingParameters rankingParams;
|
||||
|
||||
public SearchSpecification(SearchQuery query,
|
||||
@@ -40,7 +42,7 @@ public class SearchSpecification {
|
||||
SpecificationLimit rank,
|
||||
RpcQueryLimits queryLimits,
|
||||
QueryStrategy queryStrategy,
|
||||
RpcResultRankingParameters rankingParams)
|
||||
@Nullable RpcResultRankingParameters rankingParams)
|
||||
{
|
||||
this.query = query;
|
||||
this.domains = domains;
|
||||
|
@@ -13,8 +13,6 @@ import nu.marginalia.index.query.IndexSearchBudget;
|
||||
import nu.marginalia.index.query.limit.QueryStrategy;
|
||||
import nu.marginalia.index.searchset.SearchSet;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import static nu.marginalia.api.searchquery.IndexProtobufCodec.convertSpecLimit;
|
||||
|
||||
public class SearchParameters {
|
||||
@@ -88,7 +86,7 @@ public class SearchParameters {
|
||||
compiledQuery = CompiledQueryParser.parse(this.query.compiledQuery);
|
||||
compiledQueryIds = compiledQuery.mapToLong(SearchTermsUtil::getWordId);
|
||||
|
||||
rankingParams = Objects.requireNonNullElseGet(request.getParameters(), PrototypeRankingParameters::sensibleDefaults);
|
||||
rankingParams = request.hasParameters() ? request.getParameters() : PrototypeRankingParameters.sensibleDefaults();
|
||||
}
|
||||
|
||||
|
||||
|
@@ -37,7 +37,7 @@ public class SearchQueryService {
|
||||
@QueryParam String profile,
|
||||
@QueryParam String js,
|
||||
@QueryParam String recent,
|
||||
@QueryParam String title,
|
||||
@QueryParam String searchTitle,
|
||||
@QueryParam String adtech,
|
||||
@QueryParam Integer page
|
||||
) {
|
||||
@@ -47,7 +47,7 @@ public class SearchQueryService {
|
||||
SearchProfile.getSearchProfile(profile),
|
||||
SearchJsParameter.parse(js),
|
||||
SearchRecentParameter.parse(recent),
|
||||
SearchTitleParameter.parse(title),
|
||||
SearchTitleParameter.parse(searchTitle),
|
||||
SearchAdtechParameter.parse(adtech),
|
||||
false,
|
||||
Objects.requireNonNullElse(page,1));
|
||||
|
@@ -34,12 +34,12 @@
|
||||
<div class="max-w-7xl mx-auto flex flex-col space-y-4 fill-w">
|
||||
<div class="border dark:border-gray-600 dark:bg-gray-800 bg-white rounded p-2 m-4 ">
|
||||
<div class="text-slate-700 dark:text-white text-sm p-4">
|
||||
<div class="fas fa-wrench mr-1 text-margeblue dark:text-slate-200"></div>
|
||||
This is the new design and home of Marginalia Search. Migration to the new domain <pre class="inline text-red-800 dark:text-red-100">marginalia-search.com</pre> is currently <em>in progress</em>,
|
||||
so mind that some things may be a bit broken for a day or two. <a href="https://about.marginalia-search.com/article/redesign/" class="underline text-liteblue dark:text-blue-200">Read more</a>.
|
||||
<div class="fas fa-gift mr-1 text-margeblue dark:text-slate-200"></div>
|
||||
This is the new design and home of Marginalia Search.
|
||||
You can about what this entails <a href="https://about.marginalia-search.com/article/redesign/" class="underline text-liteblue dark:text-blue-200">here</a>.
|
||||
<p class="my-4"></p>
|
||||
If you have any issues or feedback regarding this change, please email
|
||||
<a href="mailto:contact@marginalia-search.com" class="underline text-liteblue dark:text-blue-200">contact@marginalia-search.com</a>.
|
||||
The old version of Marginalia Search remains available at
|
||||
<a href="https://old-search.marginalia.nu/" class="underline text-liteblue dark:text-blue-200">https://old-search.marginalia.nu/</a>.
|
||||
</div>
|
||||
</div>
|
||||
<div class="mx-auto flex flex-col sm:flex-row my-4 sm:space-x-2 space-y-2 sm:space-y-0 w-full md:w-auto px-2">
|
||||
|
@@ -1,3 +1,4 @@
|
||||
## This is a token file for automatic deployment
|
||||
|
||||
2025-01-08: Deploy executor.
|
||||
2025-01-07: Deploy executor.
|
Reference in New Issue
Block a user