Disable scoring option in morelikethis
This commit is contained in:
parent
96a908b833
commit
0ee1193632
@ -122,12 +122,13 @@ public class LuceneIndex<T, U> implements LLSnapshottable {
|
||||
U mltDocumentValue,
|
||||
@Nullable it.cavallium.dbengine.lucene.serializer.Query additionalQuery,
|
||||
long limit,
|
||||
@Nullable Float minCompetitiveScore) {
|
||||
@Nullable Float minCompetitiveScore,
|
||||
boolean enableScoring) {
|
||||
Flux<Tuple2<String, Set<String>>> mltDocumentFields
|
||||
= indicizer.getMoreLikeThisDocumentFields(key, mltDocumentValue);
|
||||
return luceneIndex
|
||||
.moreLikeThis(resolveSnapshot(snapshot), mltDocumentFields, additionalQuery, limit,
|
||||
minCompetitiveScore, indicizer.getKeyFieldName())
|
||||
minCompetitiveScore, enableScoring, indicizer.getKeyFieldName())
|
||||
.map(llSearchResult -> this.transformLuceneResult(llSearchResult, null, LLScoreMode.TOP_SCORES, limit));
|
||||
|
||||
}
|
||||
@ -145,12 +146,13 @@ public class LuceneIndex<T, U> implements LLSnapshottable {
|
||||
@Nullable it.cavallium.dbengine.lucene.serializer.Query additionalQuery,
|
||||
long limit,
|
||||
@Nullable Float minCompetitiveScore,
|
||||
boolean enableScoring,
|
||||
ValueGetter<T, U> valueGetter) {
|
||||
Flux<Tuple2<String, Set<String>>> mltDocumentFields
|
||||
= indicizer.getMoreLikeThisDocumentFields(key, mltDocumentValue);
|
||||
return luceneIndex
|
||||
.moreLikeThis(resolveSnapshot(snapshot), mltDocumentFields, additionalQuery, limit,
|
||||
minCompetitiveScore, indicizer.getKeyFieldName())
|
||||
minCompetitiveScore, enableScoring, indicizer.getKeyFieldName())
|
||||
.map(llSearchResult ->
|
||||
this.transformLuceneResultWithValues(llSearchResult, null, LLScoreMode.TOP_SCORES, limit, valueGetter));
|
||||
}
|
||||
|
@ -36,6 +36,7 @@ public interface LLLuceneIndex extends LLSnapshottable {
|
||||
@Nullable it.cavallium.dbengine.lucene.serializer.Query additionalQuery,
|
||||
long limit,
|
||||
@Nullable Float minCompetitiveScore,
|
||||
boolean enableScoring,
|
||||
String keyFieldName);
|
||||
|
||||
/**
|
||||
|
@ -366,8 +366,9 @@ public class LLLocalLuceneIndex implements LLLuceneIndex {
|
||||
@Nullable it.cavallium.dbengine.lucene.serializer.Query additionalQuery,
|
||||
long limit,
|
||||
@Nullable Float minCompetitiveScore,
|
||||
boolean enableScoring,
|
||||
String keyFieldName) {
|
||||
return moreLikeThis(snapshot, mltDocumentFieldsFlux, additionalQuery, limit, minCompetitiveScore, keyFieldName, false, 0, 1);
|
||||
return moreLikeThis(snapshot, mltDocumentFieldsFlux, additionalQuery, limit, minCompetitiveScore, enableScoring, keyFieldName, false, 0, 1);
|
||||
}
|
||||
|
||||
public Mono<LLSearchResult> distributedMoreLikeThis(@Nullable LLSnapshot snapshot,
|
||||
@ -375,18 +376,20 @@ public class LLLocalLuceneIndex implements LLLuceneIndex {
|
||||
@Nullable it.cavallium.dbengine.lucene.serializer.Query additionalQuery,
|
||||
long limit,
|
||||
@Nullable Float minCompetitiveScore,
|
||||
boolean enableScoring,
|
||||
String keyFieldName,
|
||||
long actionId,
|
||||
int scoreDivisor) {
|
||||
return moreLikeThis(snapshot, mltDocumentFieldsFlux, additionalQuery, limit, minCompetitiveScore, keyFieldName, false, actionId, scoreDivisor);
|
||||
return moreLikeThis(snapshot, mltDocumentFieldsFlux, additionalQuery, limit, minCompetitiveScore, enableScoring, keyFieldName, false, actionId, scoreDivisor);
|
||||
}
|
||||
|
||||
public Mono<Void> distributedPreMoreLikeThis(@Nullable LLSnapshot snapshot,
|
||||
Flux<Tuple2<String, Set<String>>> mltDocumentFieldsFlux,
|
||||
@Nullable it.cavallium.dbengine.lucene.serializer.Query additionalQuery,
|
||||
@Nullable Float minCompetitiveScore,
|
||||
boolean enableScoring,
|
||||
String keyFieldName, long actionId) {
|
||||
return moreLikeThis(snapshot, mltDocumentFieldsFlux, additionalQuery, -1, minCompetitiveScore, keyFieldName, true, actionId, 1)
|
||||
return moreLikeThis(snapshot, mltDocumentFieldsFlux, additionalQuery, -1, minCompetitiveScore, enableScoring, keyFieldName, true, actionId, 1)
|
||||
.flatMap(LLSearchResult::completion);
|
||||
}
|
||||
|
||||
@ -396,6 +399,7 @@ public class LLLocalLuceneIndex implements LLLuceneIndex {
|
||||
@Nullable it.cavallium.dbengine.lucene.serializer.Query additionalQuery,
|
||||
long limit,
|
||||
@Nullable Float minCompetitiveScore,
|
||||
boolean enableScoring,
|
||||
String keyFieldName,
|
||||
boolean doDistributedPre,
|
||||
long actionId,
|
||||
@ -422,7 +426,7 @@ public class LLLocalLuceneIndex implements LLLuceneIndex {
|
||||
mlt.setMinTermFreq(1);
|
||||
mlt.setMinDocFreq(3);
|
||||
mlt.setMaxDocFreqPct(20);
|
||||
mlt.setBoost(true);
|
||||
mlt.setBoost(enableScoring);
|
||||
mlt.setStopWords(EnglishItalianStopFilter.getStopWordsString());
|
||||
var similarity = getSimilarity();
|
||||
if (similarity instanceof TFIDFSimilarity) {
|
||||
@ -451,8 +455,8 @@ public class LLLocalLuceneIndex implements LLLuceneIndex {
|
||||
keyFieldName,
|
||||
scoreDivisor,
|
||||
luceneQuery,
|
||||
new Sort(SortField.FIELD_SCORE),
|
||||
ScoreMode.TOP_SCORES
|
||||
enableScoring ? new Sort(SortField.FIELD_SCORE) : null,
|
||||
enableScoring ? ScoreMode.TOP_SCORES : ScoreMode.COMPLETE_NO_SCORES
|
||||
);
|
||||
})
|
||||
.subscribeOn(luceneQueryScheduler)
|
||||
|
@ -206,6 +206,7 @@ public class LLLocalMultiLuceneIndex implements LLLuceneIndex {
|
||||
@Nullable it.cavallium.dbengine.lucene.serializer.Query additionalQuery,
|
||||
long limit,
|
||||
@Nullable Float minCompetitiveScore,
|
||||
boolean enableScoring,
|
||||
String keyFieldName) {
|
||||
long actionId;
|
||||
int scoreDivisor;
|
||||
@ -228,6 +229,7 @@ public class LLLocalMultiLuceneIndex implements LLLuceneIndex {
|
||||
mltDocumentFieldsShared,
|
||||
additionalQuery,
|
||||
minCompetitiveScore,
|
||||
enableScoring,
|
||||
keyFieldName,
|
||||
actionId
|
||||
)
|
||||
@ -253,6 +255,7 @@ public class LLLocalMultiLuceneIndex implements LLLuceneIndex {
|
||||
additionalQuery,
|
||||
limit,
|
||||
minCompetitiveScore,
|
||||
enableScoring,
|
||||
keyFieldName,
|
||||
actionId,
|
||||
scoreDivisor
|
||||
|
Loading…
Reference in New Issue
Block a user