-
Notifications
You must be signed in to change notification settings - Fork 25.6k
[POC] Multi Match Implementation to Support semantic_text #132516
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
a0d0b77
dabbb85
21245c3
8a3ca94
d5a315d
a71aa73
c17fed5
d7a7640
d8b97f3
944053f
69f439f
776a65c
a785a19
1b7501f
00f14de
6f618e4
c740804
8b47269
7064442
76af4b0
53a9a6f
de5aa6c
22a958d
6763057
fd8fbb6
3a99284
949a288
f1de7b4
cd213bb
eb30e4c
851cdd2
2e8fea2
b17f8d2
046ff0f
409e320
7ad9675
e964f2e
80560be
98ec933
2595efb
5c519bc
41dfd89
7c7fbf8
dfd27d2
b42bc6b
c1f284a
13cd7c0
0accbe2
8b45313
658f171
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -52,6 +52,7 @@ public final class MultiMatchQueryBuilder extends AbstractQueryBuilder<MultiMatc | |
| public static final int DEFAULT_MAX_EXPANSIONS = FuzzyQuery.defaultMaxExpansions; | ||
| public static final ZeroTermsQueryOption DEFAULT_ZERO_TERMS_QUERY = MatchQueryParser.DEFAULT_ZERO_TERMS_QUERY; | ||
| public static final boolean DEFAULT_FUZZY_TRANSPOSITIONS = FuzzyQuery.defaultTranspositions; | ||
| private boolean resolveInferenceFieldWildcards = true; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why did we add this to the multi match builder, rather than keeping all logic in the inference plugin? That seems odd to me and a lot of extra stuff that we have to pass around? I may be missing a good reason to do this... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for explaining your thought process around adding this. If you look at the core details of what you added, though, you're only adding a flag to the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agreed we need to adjust this. We need to separate the concepts of handling inference fields and resolving wildcards. AFAIU handling inference fields needs to be a multi-match query param so that the user can enable it (it should be false by default). In contrast, resolving wildcards is an immutable property of the query that is not configurable by the user. |
||
|
|
||
| public static final ParseField BOOST_FIELD = new ParseField("boost"); | ||
| public static final ParseField SLOP_FIELD = new ParseField("slop"); | ||
|
|
@@ -228,6 +229,12 @@ public MultiMatchQueryBuilder(StreamInput in) throws IOException { | |
| zeroTermsQuery = ZeroTermsQueryOption.readFromStream(in); | ||
| autoGenerateSynonymsPhraseQuery = in.readBoolean(); | ||
| fuzzyTranspositions = in.readBoolean(); | ||
| if (in.getTransportVersion().isPatchFrom(TransportVersions.MULTI_MATCH_SEMANTIC_TEXT_SUPPORT_8_19) | ||
| || in.getTransportVersion().onOrAfter(TransportVersions.MULTI_MATCH_SEMANTIC_TEXT_SUPPORT)) { | ||
| resolveInferenceFieldWildcards = in.readBoolean(); | ||
| } else { | ||
| resolveInferenceFieldWildcards = false; | ||
| } | ||
| } | ||
|
|
||
| @Override | ||
|
|
@@ -251,6 +258,10 @@ protected void doWriteTo(StreamOutput out) throws IOException { | |
| zeroTermsQuery.writeTo(out); | ||
| out.writeBoolean(autoGenerateSynonymsPhraseQuery); | ||
| out.writeBoolean(fuzzyTranspositions); | ||
| if (out.getTransportVersion().isPatchFrom(TransportVersions.MULTI_MATCH_SEMANTIC_TEXT_SUPPORT_8_19) | ||
| || out.getTransportVersion().onOrAfter(TransportVersions.MULTI_MATCH_SEMANTIC_TEXT_SUPPORT)) { | ||
| out.writeBoolean(resolveInferenceFieldWildcards); | ||
| } | ||
| } | ||
|
|
||
| public Object value() { | ||
|
|
@@ -513,6 +524,15 @@ public MultiMatchQueryBuilder fuzzyTranspositions(boolean fuzzyTranspositions) { | |
| return this; | ||
| } | ||
|
|
||
| public boolean resolveInferenceFieldWildcards() { | ||
| return resolveInferenceFieldWildcards; | ||
| } | ||
|
|
||
| public MultiMatchQueryBuilder resolveInferenceFieldWildcards(boolean resolveInferenceFieldWildcards) { | ||
| this.resolveInferenceFieldWildcards = resolveInferenceFieldWildcards; | ||
| return this; | ||
| } | ||
|
|
||
| @Override | ||
| public void doXContent(XContentBuilder builder, Params params) throws IOException { | ||
| builder.startObject(NAME); | ||
|
|
@@ -797,7 +817,8 @@ protected int doHashCode() { | |
| lenient, | ||
| zeroTermsQuery, | ||
| autoGenerateSynonymsPhraseQuery, | ||
| fuzzyTranspositions | ||
| fuzzyTranspositions, | ||
| resolveInferenceFieldWildcards | ||
| ); | ||
| } | ||
|
|
||
|
|
@@ -818,7 +839,8 @@ protected boolean doEquals(MultiMatchQueryBuilder other) { | |
| && Objects.equals(lenient, other.lenient) | ||
| && Objects.equals(zeroTermsQuery, other.zeroTermsQuery) | ||
| && Objects.equals(autoGenerateSynonymsPhraseQuery, other.autoGenerateSynonymsPhraseQuery) | ||
| && Objects.equals(fuzzyTranspositions, other.fuzzyTranspositions); | ||
| && Objects.equals(fuzzyTranspositions, other.fuzzyTranspositions) | ||
| && Objects.equals(resolveInferenceFieldWildcards, other.resolveInferenceFieldWildcards); | ||
| } | ||
|
|
||
| @Override | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we want to backport this to 8.19? We only want this to be in 9.2 right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AIU, it would be only
9.2but I have not discussed that yet. I will remove this in the original PR.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't backport new features, only bug fixes. 8.19 was a special case because we were developing two sibling releases (8.19 & 9.1) at the same time.