Update lucene

This commit is contained in:
Andrea Cavalli 2021-02-06 15:53:10 +01:00
parent 14c2464577
commit 2c8bb8a480
3 changed files with 10 additions and 3 deletions

View File

@ -18,7 +18,7 @@ public abstract class Indicizer<T, U> {
public abstract @NotNull T getKey(String key);
public Flux<Tuple2<String, Set<String>>> getMoreLikeThisDocumentFields(U value) {
public Flux<Tuple2<String, Set<String>>> getMoreLikeThisDocumentFields(T key, U value) {
return Flux.empty();
}
}

View File

@ -110,9 +110,11 @@ public class LuceneIndex<T, U> implements LLSnapshottable {
* @return the collection has one or more flux
*/
public Mono<SearchResultKeys<T>> moreLikeThis(@Nullable CompositeSnapshot snapshot,
T key,
U mltDocumentValue,
int limit) {
Flux<Tuple2<String, Set<String>>> mltDocumentFields = indicizer.getMoreLikeThisDocumentFields(mltDocumentValue);
Flux<Tuple2<String, Set<String>>> mltDocumentFields
= indicizer.getMoreLikeThisDocumentFields(key, mltDocumentValue);
return luceneIndex
.moreLikeThis(resolveSnapshot(snapshot), mltDocumentFields, limit, indicizer.getKeyFieldName())
.map(llSearchResult -> this.transformLuceneResult(llSearchResult, MultiSort.topScore(), limit));
@ -127,10 +129,12 @@ public class LuceneIndex<T, U> implements LLSnapshottable {
* @return the collection has one or more flux
*/
public Mono<SearchResult<T, U>> moreLikeThisWithValues(@Nullable CompositeSnapshot snapshot,
T key,
U mltDocumentValue,
int limit,
ValueGetter<T, U> valueGetter) {
Flux<Tuple2<String, Set<String>>> mltDocumentFields = indicizer.getMoreLikeThisDocumentFields(mltDocumentValue);
Flux<Tuple2<String, Set<String>>> mltDocumentFields
= indicizer.getMoreLikeThisDocumentFields(key, mltDocumentValue);
return luceneIndex
.moreLikeThis(resolveSnapshot(snapshot), mltDocumentFields, limit, indicizer.getKeyFieldName())
.map(llSearchResult ->

View File

@ -35,6 +35,9 @@ public class DatabaseEmpty {
public static final class Nothing {
@SuppressWarnings("InstantiationOfUtilityClass")
public static Nothing INSTANCE = new Nothing();
private Nothing() {
}