Update LuceneIndex.java and SearchResultItem.java
This commit is contained in:
parent
258e7f7d7c
commit
3e36bfe732
|
@ -94,7 +94,7 @@ public class LuceneIndex<T, U> implements LLSnapshottable {
|
||||||
ValueGetter<T, U> valueGetter) {
|
ValueGetter<T, U> valueGetter) {
|
||||||
var mappedKeys = llSearchResult
|
var mappedKeys = llSearchResult
|
||||||
.results()
|
.results()
|
||||||
.map(flux -> flux.flatMap(item -> {
|
.map(flux -> flux.flatMapSequential(item -> {
|
||||||
var key = indicizer.getKey(item.getKey());
|
var key = indicizer.getKey(item.getKey());
|
||||||
return valueGetter.get(key).map(value -> new SearchResultItem<>(key, value, item.getScore()));
|
return valueGetter.get(key).map(value -> new SearchResultItem<>(key, value, item.getScore()));
|
||||||
}));
|
}));
|
||||||
|
|
|
@ -2,8 +2,9 @@ package it.cavallium.dbengine.client;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.StringJoiner;
|
import java.util.StringJoiner;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class SearchResultItem<T, U> {
|
public class SearchResultItem<T, U> implements Comparable<SearchResultItem<T, U>> {
|
||||||
private final T key;
|
private final T key;
|
||||||
private final U value;
|
private final U value;
|
||||||
private final float score;
|
private final float score;
|
||||||
|
@ -51,4 +52,9 @@ public class SearchResultItem<T, U> {
|
||||||
.add("score=" + score)
|
.add("score=" + score)
|
||||||
.toString();
|
.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int compareTo(@NotNull SearchResultItem<T, U> o) {
|
||||||
|
return Float.compare(o.score, this.score);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user