2020-12-07 22:15:18 +01:00
|
|
|
package it.cavallium.dbengine.database;
|
|
|
|
|
|
|
|
import java.util.Map;
|
|
|
|
import java.util.Set;
|
|
|
|
import org.jetbrains.annotations.Nullable;
|
|
|
|
import reactor.core.publisher.Mono;
|
|
|
|
|
2021-01-30 01:41:04 +01:00
|
|
|
public interface LLLuceneIndex extends LLSnapshottable {
|
2020-12-07 22:15:18 +01:00
|
|
|
|
|
|
|
String getLuceneIndexName();
|
|
|
|
|
2021-01-30 01:41:04 +01:00
|
|
|
Mono<Void> addDocument(LLTerm id, LLDocument doc);
|
2020-12-07 22:15:18 +01:00
|
|
|
|
2021-01-30 01:41:04 +01:00
|
|
|
Mono<Void> addDocuments(Iterable<LLTerm> keys, Iterable<LLDocument> documents);
|
2020-12-07 22:15:18 +01:00
|
|
|
|
2021-01-30 01:41:04 +01:00
|
|
|
Mono<Void> deleteDocument(LLTerm id);
|
2020-12-07 22:15:18 +01:00
|
|
|
|
2021-01-30 01:41:04 +01:00
|
|
|
Mono<Void> updateDocument(LLTerm id, LLDocument document);
|
2020-12-07 22:15:18 +01:00
|
|
|
|
2021-01-30 01:41:04 +01:00
|
|
|
Mono<Void> updateDocuments(Iterable<LLTerm> ids, Iterable<LLDocument> documents);
|
2020-12-07 22:15:18 +01:00
|
|
|
|
2021-01-30 01:41:04 +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>
|
2021-01-29 17:19:01 +01:00
|
|
|
* @return the collection has one or more flux
|
2020-12-08 10:52:15 +01:00
|
|
|
*/
|
2021-01-29 17:19:01 +01:00
|
|
|
Mono<LLSearchResult> moreLikeThis(@Nullable LLSnapshot snapshot,
|
2020-12-07 22:15:18 +01:00
|
|
|
Map<String, Set<String>> mltDocumentFields,
|
|
|
|
int limit,
|
2021-01-29 17:19:01 +01:00
|
|
|
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
|
|
|
|
*/
|
2021-01-29 17:19:01 +01:00
|
|
|
Mono<LLSearchResult> search(@Nullable LLSnapshot snapshot,
|
2020-12-07 22:15:18 +01:00
|
|
|
String query,
|
|
|
|
int limit,
|
|
|
|
@Nullable LLSort sort,
|
2021-01-29 17:19:01 +01:00
|
|
|
LLScoreMode scoreMode,
|
2020-12-07 22:15:18 +01:00
|
|
|
String keyFieldName);
|
|
|
|
|
2021-01-30 01:41:04 +01:00
|
|
|
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();
|
2021-01-30 01:41:04 +01:00
|
|
|
|
|
|
|
Mono<Void> close();
|
2020-12-07 22:15:18 +01:00
|
|
|
}
|