Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
2847ebd
Add rrf plugin as ent-search plugin dependency
Mikep86 Feb 27, 2025
46db23d
Added HybridRetrieverBuilder class
Mikep86 Feb 28, 2025
e74cbe8
Added WrappedStandardRetrieverBuilder class
Mikep86 Feb 28, 2025
b58a022
Refactored wrapper class
Mikep86 Feb 28, 2025
83d0d9a
Fix equality/hashcode bug
Mikep86 Feb 28, 2025
c41af7d
Add query builder getter
Mikep86 Feb 28, 2025
2d9c0cd
Updated HybridRetrieverBuilder to be a wrapper
Mikep86 Feb 28, 2025
1e083fd
Implemented doToXContent
Mikep86 Feb 28, 2025
848614a
Added TODO
Mikep86 Feb 28, 2025
f5fc29e
Implemented fromXContent
Mikep86 Feb 28, 2025
de1b185
Add hybrid retriever to enterprise search plugin
Mikep86 Feb 28, 2025
1f41e8d
Make rank-rrf plugin extensible
Mikep86 Feb 28, 2025
578028c
Updated MinMaxScoreNormalizer to make the initial minimum configurable
Mikep86 Mar 6, 2025
4f06a7f
Removed StandardRetrieverBuilderWrapper
Mikep86 Mar 10, 2025
c2b7ffe
Move hybrid retriever to rank-rrf plugin
Mikep86 Mar 10, 2025
80da26a
Merge branch 'main' into hybrid-retriever-poc
Mikep86 Mar 10, 2025
a7b9e86
Made inference plugin a dependency of the rank-rrf plugin
Mikep86 Mar 10, 2025
4e0f5c5
Added rerank and rerank_inference_id fields
Mikep86 Mar 10, 2025
27e3497
Integrated text similarity reranker into hybrid retriever
Mikep86 Mar 10, 2025
82e7e0e
Merge branch 'main' into hybrid-retriever-poc
Mikep86 Mar 11, 2025
596fef0
Merge branch 'main' into hybrid-retriever-poc
Mikep86 Mar 12, 2025
94713c8
Parse field strings for weights
Mikep86 Mar 12, 2025
70c01bf
Added per-field query settings
Mikep86 Mar 13, 2025
ea83a3a
Added match phrase query settings
Mikep86 Mar 13, 2025
b81c34c
Merge branch 'main' into hybrid-retriever-poc
Mikep86 Mar 17, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -279,16 +279,16 @@ public final boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
RetrieverBuilder that = (RetrieverBuilder) o;
return Objects.equals(preFilterQueryBuilders, that.preFilterQueryBuilders)
&& Objects.equals(minScore, that.minScore)
return Objects.equals(getPreFilterQueryBuilders(), that.getPreFilterQueryBuilders())
&& Objects.equals(minScore(), that.minScore())
&& doEquals(o);
}

protected abstract boolean doEquals(Object o);

@Override
public final int hashCode() {
return Objects.hash(getClass(), preFilterQueryBuilders, minScore, doHashCode());
return Objects.hash(getClass(), getPreFilterQueryBuilders(), minScore(), doHashCode());
}

protected abstract int doHashCode();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ private StandardRetrieverBuilder(StandardRetrieverBuilder clone) {
this.terminateAfter = clone.terminateAfter;
}

public QueryBuilder getQueryBuilder() {
return queryBuilder;
}

@Override
public RetrieverBuilder rewrite(QueryRewriteContext ctx) throws IOException {
boolean changed = false;
Expand Down
1 change: 1 addition & 0 deletions x-pack/plugin/inference/src/main/java/module-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
exports org.elasticsearch.xpack.inference;
exports org.elasticsearch.xpack.inference.action.task;
exports org.elasticsearch.xpack.inference.telemetry;
exports org.elasticsearch.xpack.inference.rank.textsimilarity;

provides org.elasticsearch.features.FeatureSpecification with org.elasticsearch.xpack.inference.InferenceFeatures;
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.elasticsearch.xcontent.XContentParser;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

Expand All @@ -49,7 +50,7 @@ public class TextSimilarityRankRetrieverBuilder extends CompoundRetrieverBuilder
public static final ConstructingObjectParser<TextSimilarityRankRetrieverBuilder, RetrieverParserContext> PARSER =
new ConstructingObjectParser<>(TextSimilarityRankBuilder.NAME, args -> {
RetrieverBuilder retrieverBuilder = (RetrieverBuilder) args[0];
String inferenceId = args[1] == null ? DEFAULT_RERANK_ID : (String) args[1];
String inferenceId = (String) args[1];
String inferenceText = (String) args[2];
String field = (String) args[3];
int rankWindowSize = args[4] == null ? DEFAULT_RANK_WINDOW_SIZE : (int) args[4];
Expand Down Expand Up @@ -104,11 +105,17 @@ public TextSimilarityRankRetrieverBuilder(
int rankWindowSize,
boolean failuresAllowed
) {
super(List.of(new RetrieverSource(retrieverBuilder, null)), rankWindowSize);
this.inferenceId = inferenceId;
this.inferenceText = inferenceText;
this.field = field;
this.failuresAllowed = failuresAllowed;
this(
List.of(new RetrieverSource(retrieverBuilder, null)),
inferenceId,
inferenceText,
field,
rankWindowSize,
null,
failuresAllowed,
null,
new ArrayList<>()
);
}

public TextSimilarityRankRetrieverBuilder(
Expand All @@ -124,9 +131,11 @@ public TextSimilarityRankRetrieverBuilder(
) {
super(retrieverSource, rankWindowSize);
if (retrieverSource.size() != 1) {
throw new IllegalArgumentException("[" + getName() + "] retriever should have exactly one inner retriever");
throw new IllegalArgumentException(
"[" + TextSimilarityRankBuilder.NAME + "] retriever should have exactly one inner retriever"
);
}
this.inferenceId = inferenceId;
this.inferenceId = inferenceId == null ? DEFAULT_RERANK_ID : inferenceId;
this.inferenceText = inferenceText;
this.field = field;
this.minScore = minScore;
Expand Down
3 changes: 2 additions & 1 deletion x-pack/plugin/rank-rrf/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@ esplugin {
name = 'rank-rrf'
description = 'Reciprocal rank fusion in search.'
classname ='org.elasticsearch.xpack.rank.rrf.RRFRankPlugin'
extendedPlugins = ['x-pack-core']
extendedPlugins = ['x-pack-core', 'x-pack-inference']
}

dependencies {
compileOnly project(path: xpackModule('core'))
compileOnly project(path: xpackModule('inference'))

testImplementation(testArtifact(project(xpackModule('core'))))
testImplementation(testArtifact(project(':server')))
Expand Down
1 change: 1 addition & 0 deletions x-pack/plugin/rank-rrf/src/main/java/module-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
requires org.elasticsearch.xcontent;
requires org.elasticsearch.server;
requires org.elasticsearch.xcore;
requires org.elasticsearch.inference;

exports org.elasticsearch.xpack.rank;
exports org.elasticsearch.xpack.rank.rrf;
Expand Down
Loading