mirror of
https://github.com/MarginaliaSearch/MarginaliaSearch.git
synced 2025-10-06 07:32:38 +02:00
Compare commits
5 Commits
deploy-030
...
deploy-030
Author | SHA1 | Date | |
---|---|---|---|
|
215e12afe9 | ||
|
2716bce918 | ||
|
caf2e6fbb7 | ||
|
233f0acfb1 | ||
|
e3a4ff02e9 |
@@ -20,6 +20,7 @@ import nu.marginalia.index.model.SearchParameters;
|
|||||||
import nu.marginalia.index.model.SearchTerms;
|
import nu.marginalia.index.model.SearchTerms;
|
||||||
import nu.marginalia.index.positions.PositionsFileReader;
|
import nu.marginalia.index.positions.PositionsFileReader;
|
||||||
import nu.marginalia.index.query.IndexQuery;
|
import nu.marginalia.index.query.IndexQuery;
|
||||||
|
import nu.marginalia.index.query.IndexSearchBudget;
|
||||||
import nu.marginalia.index.results.DomainRankingOverrides;
|
import nu.marginalia.index.results.DomainRankingOverrides;
|
||||||
import nu.marginalia.index.results.IndexResultRankingService;
|
import nu.marginalia.index.results.IndexResultRankingService;
|
||||||
import nu.marginalia.index.results.model.ids.CombinedDocIdList;
|
import nu.marginalia.index.results.model.ids.CombinedDocIdList;
|
||||||
@@ -162,10 +163,10 @@ public class PerfTestMain {
|
|||||||
int sum = 0;
|
int sum = 0;
|
||||||
|
|
||||||
Instant runEndTime = Instant.now().plus(warmupTime);
|
Instant runEndTime = Instant.now().plus(warmupTime);
|
||||||
|
|
||||||
int iter;
|
int iter;
|
||||||
|
IndexSearchBudget budget = new IndexSearchBudget(10000);
|
||||||
for (iter = 0;; iter++) {
|
for (iter = 0;; iter++) {
|
||||||
sum += rankingService.rankResults(rankingContext, docIds, false).size();
|
sum += rankingService.rankResults(rankingContext, budget, docIds, false).size();
|
||||||
if ((iter % 100) == 0 && Instant.now().isAfter(runEndTime)) {
|
if ((iter % 100) == 0 && Instant.now().isAfter(runEndTime)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -178,7 +179,7 @@ public class PerfTestMain {
|
|||||||
List<Double> times = new ArrayList<>();
|
List<Double> times = new ArrayList<>();
|
||||||
for (iter = 0;; iter++) {
|
for (iter = 0;; iter++) {
|
||||||
long start = System.nanoTime();
|
long start = System.nanoTime();
|
||||||
sum2 += rankingService.rankResults(rankingContext, docIds, false).size();
|
sum2 += rankingService.rankResults(rankingContext, budget, docIds, false).size();
|
||||||
long end = System.nanoTime();
|
long end = System.nanoTime();
|
||||||
times.add((end - start)/1_000_000.);
|
times.add((end - start)/1_000_000.);
|
||||||
|
|
||||||
|
@@ -66,7 +66,7 @@ public class IndexQueryExecution {
|
|||||||
|
|
||||||
// Await evaluation task termination
|
// Await evaluation task termination
|
||||||
synchronized (IndexQueryExecution.this) {
|
synchronized (IndexQueryExecution.this) {
|
||||||
while (evaluationJobCounter > 0) {
|
while (evaluationJobCounter > 0 && budget.hasTimeLeft()) {
|
||||||
IndexQueryExecution.this.wait(budget.timeLeft());
|
IndexQueryExecution.this.wait(budget.timeLeft());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -103,7 +103,7 @@ public class IndexQueryExecution {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (stealWork) {
|
if (stealWork) {
|
||||||
resultHeap.addAll(rankingService.rankResults(rankingContext, docIds, false));
|
resultHeap.addAll(rankingService.rankResults(rankingContext, budget, docIds, false));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Spawn an evaluation task
|
// Spawn an evaluation task
|
||||||
@@ -120,7 +120,7 @@ public class IndexQueryExecution {
|
|||||||
try {
|
try {
|
||||||
if (!budget.hasTimeLeft())
|
if (!budget.hasTimeLeft())
|
||||||
return;
|
return;
|
||||||
resultHeap.addAll(rankingService.rankResults(rankingContext, docIds, false));
|
resultHeap.addAll(rankingService.rankResults(rankingContext, budget, docIds, false));
|
||||||
} finally {
|
} finally {
|
||||||
synchronized (IndexQueryExecution.this) {
|
synchronized (IndexQueryExecution.this) {
|
||||||
if (--evaluationJobCounter == 0) {
|
if (--evaluationJobCounter == 0) {
|
||||||
|
@@ -20,6 +20,7 @@ import nu.marginalia.index.index.CombinedIndexReader;
|
|||||||
import nu.marginalia.index.index.StatefulIndex;
|
import nu.marginalia.index.index.StatefulIndex;
|
||||||
import nu.marginalia.index.model.ResultRankingContext;
|
import nu.marginalia.index.model.ResultRankingContext;
|
||||||
import nu.marginalia.index.model.SearchTermsUtil;
|
import nu.marginalia.index.model.SearchTermsUtil;
|
||||||
|
import nu.marginalia.index.query.IndexSearchBudget;
|
||||||
import nu.marginalia.index.results.model.PhraseConstraintGroupList;
|
import nu.marginalia.index.results.model.PhraseConstraintGroupList;
|
||||||
import nu.marginalia.index.results.model.QuerySearchTerms;
|
import nu.marginalia.index.results.model.QuerySearchTerms;
|
||||||
import nu.marginalia.index.results.model.ids.CombinedDocIdList;
|
import nu.marginalia.index.results.model.ids.CombinedDocIdList;
|
||||||
@@ -58,6 +59,7 @@ public class IndexResultRankingService {
|
|||||||
|
|
||||||
public List<SearchResultItem> rankResults(
|
public List<SearchResultItem> rankResults(
|
||||||
ResultRankingContext rankingContext,
|
ResultRankingContext rankingContext,
|
||||||
|
IndexSearchBudget budget,
|
||||||
CombinedDocIdList resultIds,
|
CombinedDocIdList resultIds,
|
||||||
boolean exportDebugData)
|
boolean exportDebugData)
|
||||||
{
|
{
|
||||||
@@ -94,7 +96,7 @@ public class IndexResultRankingService {
|
|||||||
// Iterate over documents by their index in the combinedDocIds, as we need the index for the
|
// Iterate over documents by their index in the combinedDocIds, as we need the index for the
|
||||||
// term data arrays as well
|
// term data arrays as well
|
||||||
|
|
||||||
for (int i = 0; i < resultIds.size(); i++) {
|
for (int i = 0; i < resultIds.size() && budget.hasTimeLeft(); i++) {
|
||||||
|
|
||||||
// Prepare term-level data for the document
|
// Prepare term-level data for the document
|
||||||
for (int ti = 0; ti < flags.length; ti++) {
|
for (int ti = 0; ti < flags.length; ti++) {
|
||||||
@@ -171,9 +173,10 @@ public class IndexResultRankingService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
resultsList.clear();
|
resultsList.clear();
|
||||||
|
IndexSearchBudget budget = new IndexSearchBudget(10000);
|
||||||
resultsList.addAll(this.rankResults(
|
resultsList.addAll(this.rankResults(
|
||||||
resultRankingContext,
|
resultRankingContext,
|
||||||
new CombinedDocIdList(combinedIdsList),
|
budget, new CombinedDocIdList(combinedIdsList),
|
||||||
true)
|
true)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user