CavalliumDBEngine/src/main/java/it/cavallium/dbengine/database/indicizer/LuceneIndicizerWriter.java

52 lines
1.5 KiB
Java
Raw Normal View History

package it.cavallium.dbengine.database.indicizer;
import it.cavallium.dbengine.client.CompositeSnapshot;
2021-01-30 22:14:48 +01:00
import it.cavallium.dbengine.database.DatabaseMemoryMode;
import it.cavallium.dbengine.database.LLScoreMode;
import it.cavallium.dbengine.database.LLSearchResult;
import it.cavallium.dbengine.database.LLSort;
2021-02-03 13:48:30 +01:00
import it.cavallium.dbengine.lucene.serializer.Query;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import reactor.util.function.Tuple2;
2021-02-03 14:37:02 +01:00
@SuppressWarnings("unused")
public interface LuceneIndicizerWriter<T, U> {
Mono<Void> add(T key, U value);
default Mono<Void> addMulti(@NotNull Flux<Tuple2<T, U>> values) {
return values.flatMap(tuple -> this.add(tuple.getT1(), tuple.getT2())).then();
}
Mono<Void> remove(T key);
Mono<Void> update(T key, U value);
default Mono<Void> updateMulti(@NotNull Flux<Tuple2<T, U>> values) {
return values.flatMap(tuple -> this.update(tuple.getT1(), tuple.getT2())).then();
}
Mono<Void> clearIndex();
Mono<LLSearchResult> moreLikeThis(@Nullable CompositeSnapshot snapshot,
U mltDocumentValue,
int limit);
Mono<LLSearchResult> search(@Nullable CompositeSnapshot snapshot,
2021-02-03 13:48:30 +01:00
Query query,
int limit,
@Nullable LLSort sort,
LLScoreMode scoreMode);
2021-02-03 13:48:30 +01:00
Mono<Long> count(@Nullable CompositeSnapshot snapshot, Query query);
Mono<Void> close();
Mono<T> getKey(String key);
DatabaseMemoryMode getMemoryMode();
}