2021-01-30 22:09:04 +01:00
|
|
|
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;
|
2021-01-30 22:09:04 +01:00
|
|
|
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;
|
2021-01-30 22:09:04 +01:00
|
|
|
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")
|
2021-01-30 22:09:04 +01:00
|
|
|
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,
|
2021-01-30 22:09:04 +01:00
|
|
|
int limit,
|
|
|
|
@Nullable LLSort sort,
|
|
|
|
LLScoreMode scoreMode);
|
|
|
|
|
2021-02-03 13:48:30 +01:00
|
|
|
Mono<Long> count(@Nullable CompositeSnapshot snapshot, Query query);
|
2021-01-30 22:09:04 +01:00
|
|
|
|
|
|
|
Mono<Void> close();
|
|
|
|
|
|
|
|
Mono<T> getKey(String key);
|
|
|
|
|
|
|
|
DatabaseMemoryMode getMemoryMode();
|
|
|
|
}
|