package it.cavallium.dbengine.database; import it.cavallium.data.generator.nativedata.Nullablefloat; import it.cavallium.dbengine.client.query.current.data.NoSort; import it.cavallium.dbengine.client.query.current.data.Query; import it.cavallium.dbengine.client.query.current.data.QueryParams; import it.cavallium.dbengine.client.query.current.data.ScoreMode; import it.cavallium.dbengine.client.query.current.data.TotalHitsCount; import it.cavallium.dbengine.lucene.LuceneUtils; import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Set; import org.jetbrains.annotations.Nullable; import reactor.core.publisher.Flux; import reactor.core.publisher.GroupedFlux; import reactor.core.publisher.Mono; import reactor.util.function.Tuple2; public interface LLLuceneIndex extends LLSnapshottable { String getLuceneIndexName(); Mono addDocument(LLTerm id, LLDocument doc); Mono addDocuments(Flux> documents); Mono deleteDocument(LLTerm id); Mono updateDocument(LLTerm id, LLDocument document); Mono updateDocuments(Mono> documents); Mono deleteAll(); /** * @param queryParams the limit is valid for each lucene instance. If you have 15 instances, the number of elements * returned can be at most limit * 15. *

* The additional query will be used with the moreLikeThis query: "mltQuery AND additionalQuery" * @return the collection has one or more flux */ Mono moreLikeThis(@Nullable LLSnapshot snapshot, QueryParams queryParams, String keyFieldName, Flux>> mltDocumentFields); /** * @param queryParams the limit is valid for each lucene instance. If you have 15 instances, the number of elements * returned can be at most limit * 15 * @return the collection has one or more flux */ Mono search(@Nullable LLSnapshot snapshot, QueryParams queryParams, String keyFieldName); default Mono count(@Nullable LLSnapshot snapshot, Query query) { QueryParams params = QueryParams.of(query, 0, 0, Nullablefloat.empty(), NoSort.of(), ScoreMode.of(false, false)); return Mono.from(this.search(snapshot, params, null) .flatMap(llSearchResultShard -> llSearchResultShard.release().thenReturn(llSearchResultShard.totalHitsCount())) .defaultIfEmpty(TotalHitsCount.of(0, true))); } boolean isLowMemoryMode(); Mono close(); /** * Flush writes to disk */ Mono flush(); /** * Refresh index searcher */ Mono refresh(boolean force); }