More tests

This commit is contained in:
Andrea Cavalli 2021-10-16 00:50:06 +02:00
parent f91617c7ec
commit f6aab7dafb
3 changed files with 19 additions and 16 deletions

View File

@ -26,7 +26,6 @@ import it.cavallium.dbengine.database.collections.SubStageGetterMap;
import it.cavallium.dbengine.database.disk.MemorySegmentUtils;
import it.cavallium.dbengine.database.serialization.Serializer;
import it.cavallium.dbengine.database.serialization.SerializerFixedBinaryLength;
import it.cavallium.dbengine.lucene.StringIndicizer;
import java.nio.file.Path;
import java.util.Map;
import java.util.Objects;
@ -36,7 +35,6 @@ import org.jetbrains.annotations.Nullable;
import org.reactivestreams.Publisher;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import reactor.core.scheduler.Schedulers;
public class DbTestUtils {

View File

@ -1,4 +1,4 @@
package it.cavallium.dbengine.lucene;
package it.cavallium.dbengine;
import com.google.common.primitives.Ints;
import com.google.common.primitives.Longs;

View File

@ -137,13 +137,16 @@ public class TestLuceneSearches {
}
private static final Flux<Boolean> multi = Flux.just(false, true);
private static final Flux<MultiSort<SearchResultKey<String>>> multiSort = Flux.just(MultiSort.topScore(),
private static final Flux<MultiSort<SearchResultKey<String>>> multiSort = Flux.just(
MultiSort.topScore(),
//todo: fix random sort field
//MultiSort.randomSortField(),
MultiSort.noSort(),
MultiSort.docSort(),
MultiSort.numericSort("longsort", false),
MultiSort.numericSort("longsort", true)
MultiSort.numericSort("longsort", true),
MultiSort.numericSort("intsort", false),
MultiSort.numericSort("intsort", true)
);
private static Flux<LocalSearcher> getSearchers(ExpectedQueryType info) {
@ -293,11 +296,12 @@ public class TestLuceneSearches {
@ParameterizedTest
@MethodSource("provideQueryArgumentsScoreModeAndSort")
public void testSearchNoDocs(boolean shards, MultiSort<SearchResultKey<String>> multiSort) throws Throwable {
ClientQueryParamsBuilder<SearchResultKey<String>> queryBuilder = ClientQueryParams.builder();
queryBuilder.query(new MatchNoDocsQuery());
queryBuilder.snapshot(null);
queryBuilder.complete(true);
queryBuilder.sort(multiSort);
var queryBuilder = ClientQueryParams
.<SearchResultKey<String>>builder()
.query(new MatchNoDocsQuery())
.snapshot(null)
.complete(true)
.sort(multiSort);
ExpectedQueryType expectedQueryType = new ExpectedQueryType(shards, multiSort, true, false);
testSearch(queryBuilder, expectedQueryType);
@ -306,11 +310,12 @@ public class TestLuceneSearches {
@ParameterizedTest
@MethodSource("provideQueryArgumentsScoreModeAndSort")
public void testSearchAllDocs(boolean shards, MultiSort<SearchResultKey<String>> multiSort) throws Throwable {
ClientQueryParamsBuilder<SearchResultKey<String>> queryBuilder = ClientQueryParams.builder();
queryBuilder.query(new MatchAllDocsQuery());
queryBuilder.snapshot(null);
queryBuilder.complete(true);
queryBuilder.sort(multiSort);
var queryBuilder = ClientQueryParams
.<SearchResultKey<String>>builder()
.query(new MatchAllDocsQuery())
.snapshot(null)
.complete(true)
.sort(multiSort);
ExpectedQueryType expectedQueryType = new ExpectedQueryType(shards, multiSort, true, false);
testSearch(queryBuilder, expectedQueryType);