CavalliumDBEngine/src/main/java/it/cavallium/dbengine/database/LLLuceneIndex.java

62 lines
1.7 KiB
Java
Raw Normal View History

2020-12-07 22:15:18 +01:00
package it.cavallium.dbengine.database;
import java.util.Set;
import org.jetbrains.annotations.Nullable;
import reactor.core.publisher.Flux;
import reactor.core.publisher.GroupedFlux;
2020-12-07 22:15:18 +01:00
import reactor.core.publisher.Mono;
import reactor.util.function.Tuple2;
2020-12-07 22:15:18 +01:00
public interface LLLuceneIndex extends LLSnapshottable {
2020-12-07 22:15:18 +01:00
String getLuceneIndexName();
Mono<Void> addDocument(LLTerm id, LLDocument doc);
2020-12-07 22:15:18 +01:00
Mono<Void> addDocuments(Flux<GroupedFlux<LLTerm, LLDocument>> documents);
2020-12-07 22:15:18 +01:00
Mono<Void> deleteDocument(LLTerm id);
2020-12-07 22:15:18 +01:00
Mono<Void> updateDocument(LLTerm id, LLDocument document);
2020-12-07 22:15:18 +01:00
Mono<Void> updateDocuments(Flux<GroupedFlux<LLTerm, LLDocument>> documents);
2020-12-07 22:15:18 +01:00
Mono<Void> deleteAll();
2020-12-07 22:15:18 +01:00
2020-12-08 10:52:15 +01:00
/**
*
* @param limit the limit is valid for each lucene instance.
* If you have 15 instances, the number of elements returned
* can be at most <code>limit * 15</code>
* @return the collection has one or more flux
2020-12-08 10:52:15 +01:00
*/
Mono<LLSearchResult> moreLikeThis(@Nullable LLSnapshot snapshot,
Flux<Tuple2<String, Set<String>>> mltDocumentFields,
2020-12-07 22:15:18 +01:00
int limit,
String keyFieldName);
2020-12-07 22:15:18 +01:00
/**
*
2020-12-08 10:51:21 +01:00
* @param limit the limit is valid for each lucene instance.
* If you have 15 instances, the number of elements returned
* can be at most <code>limit * 15</code>
2020-12-07 22:15:18 +01:00
* @return the collection has one or more flux
*/
Mono<LLSearchResult> search(@Nullable LLSnapshot snapshot,
2020-12-07 22:15:18 +01:00
String query,
int limit,
@Nullable LLSort sort,
LLScoreMode scoreMode,
2020-12-07 22:15:18 +01:00
String keyFieldName);
default Mono<Long> count(@Nullable LLSnapshot snapshot, String queryString) {
return this.search(snapshot, queryString, 0, null, null, null)
.flatMap(LLSearchResult::totalHitsCount)
.single();
}
2020-12-07 22:15:18 +01:00
boolean isLowMemoryMode();
Mono<Void> close();
2020-12-07 22:15:18 +01:00
}