Move InnerHitBuilder queries BWC version to 5.5 after the backport

Relates #24676
This commit is contained in:
Jim Ferenczi 2017-05-23 22:41:39 +02:00
parent 13a86fec99
commit 4707377cea
5 changed files with 14 additions and 14 deletions

View File

@ -126,7 +126,7 @@ public final class InnerHitBuilder extends ToXContentToBytes implements Writeabl
*/ */
public InnerHitBuilder(StreamInput in) throws IOException { public InnerHitBuilder(StreamInput in) throws IOException {
name = in.readOptionalString(); name = in.readOptionalString();
if (in.getVersion().before(Version.V_6_0_0_alpha2_UNRELEASED)) { if (in.getVersion().before(Version.V_5_5_0_UNRELEASED)) {
in.readOptionalString(); in.readOptionalString();
in.readOptionalString(); in.readOptionalString();
} }
@ -156,7 +156,7 @@ public final class InnerHitBuilder extends ToXContentToBytes implements Writeabl
} }
} }
highlightBuilder = in.readOptionalWriteable(HighlightBuilder::new); highlightBuilder = in.readOptionalWriteable(HighlightBuilder::new);
if (in.getVersion().before(Version.V_6_0_0_alpha2_UNRELEASED)) { if (in.getVersion().before(Version.V_5_5_0_UNRELEASED)) {
/** /**
* this is needed for BWC with nodes pre 5.5 * this is needed for BWC with nodes pre 5.5
*/ */
@ -168,8 +168,8 @@ public final class InnerHitBuilder extends ToXContentToBytes implements Writeabl
@Override @Override
public void writeTo(StreamOutput out) throws IOException { public void writeTo(StreamOutput out) throws IOException {
if (out.getVersion().before(Version.V_6_0_0_alpha2_UNRELEASED)) { if (out.getVersion().before(Version.V_5_5_0_UNRELEASED)) {
throw new IOException("Invalid output version, must >= " + Version.V_6_0_0_alpha2_UNRELEASED.toString()); throw new IOException("Invalid output version, must >= " + Version.V_5_5_0_UNRELEASED.toString());
} }
out.writeOptionalString(name); out.writeOptionalString(name);
out.writeBoolean(ignoreUnmapped); out.writeBoolean(ignoreUnmapped);
@ -207,8 +207,8 @@ public final class InnerHitBuilder extends ToXContentToBytes implements Writeabl
* Should only be used to send nested inner hits to nodes pre 5.5. * Should only be used to send nested inner hits to nodes pre 5.5.
*/ */
protected void writeToNestedBWC(StreamOutput out, QueryBuilder query, String nestedPath) throws IOException { protected void writeToNestedBWC(StreamOutput out, QueryBuilder query, String nestedPath) throws IOException {
assert out.getVersion().before(Version.V_6_0_0_alpha2_UNRELEASED) : assert out.getVersion().before(Version.V_5_5_0_UNRELEASED) :
"invalid output version, must be < " + Version.V_6_0_0_alpha2_UNRELEASED.toString(); "invalid output version, must be < " + Version.V_5_5_0_UNRELEASED.toString();
writeToBWC(out, query, nestedPath, null); writeToBWC(out, query, nestedPath, null);
} }
@ -217,8 +217,8 @@ public final class InnerHitBuilder extends ToXContentToBytes implements Writeabl
* Should only be used to send collapsing inner hits to nodes pre 5.5. * Should only be used to send collapsing inner hits to nodes pre 5.5.
*/ */
public void writeToCollapseBWC(StreamOutput out) throws IOException { public void writeToCollapseBWC(StreamOutput out) throws IOException {
assert out.getVersion().before(Version.V_6_0_0_alpha2_UNRELEASED) : assert out.getVersion().before(Version.V_5_5_0_UNRELEASED) :
"invalid output version, must be < " + Version.V_6_0_0_alpha2_UNRELEASED.toString(); "invalid output version, must be < " + Version.V_5_5_0_UNRELEASED.toString();
writeToBWC(out, new MatchAllQueryBuilder(), null, null); writeToBWC(out, new MatchAllQueryBuilder(), null, null);
} }
@ -227,8 +227,8 @@ public final class InnerHitBuilder extends ToXContentToBytes implements Writeabl
* Should only be used to send hasParent or hasChild inner hits to nodes pre 5.5. * Should only be used to send hasParent or hasChild inner hits to nodes pre 5.5.
*/ */
public void writeToParentChildBWC(StreamOutput out, QueryBuilder query, String parentChildPath) throws IOException { public void writeToParentChildBWC(StreamOutput out, QueryBuilder query, String parentChildPath) throws IOException {
assert(out.getVersion().before(Version.V_6_0_0_alpha2_UNRELEASED)) : assert(out.getVersion().before(Version.V_5_5_0_UNRELEASED)) :
"invalid output version, must be < " + Version.V_6_0_0_alpha2_UNRELEASED.toString(); "invalid output version, must be < " + Version.V_5_5_0_UNRELEASED.toString();
writeToBWC(out, query, null, parentChildPath); writeToBWC(out, query, null, parentChildPath);
} }

View File

@ -103,7 +103,7 @@ public class NestedQueryBuilder extends AbstractQueryBuilder<NestedQueryBuilder>
out.writeString(path); out.writeString(path);
out.writeVInt(scoreMode.ordinal()); out.writeVInt(scoreMode.ordinal());
out.writeNamedWriteable(query); out.writeNamedWriteable(query);
if (out.getVersion().before(Version.V_6_0_0_alpha2_UNRELEASED)) { if (out.getVersion().before(Version.V_5_5_0_UNRELEASED)) {
final boolean hasInnerHit = innerHitBuilder != null; final boolean hasInnerHit = innerHitBuilder != null;
out.writeBoolean(hasInnerHit); out.writeBoolean(hasInnerHit);
if (hasInnerHit) { if (hasInnerHit) {

View File

@ -82,7 +82,7 @@ public class CollapseBuilder extends ToXContentToBytes implements Writeable {
public void writeTo(StreamOutput out) throws IOException { public void writeTo(StreamOutput out) throws IOException {
out.writeString(field); out.writeString(field);
out.writeVInt(maxConcurrentGroupRequests); out.writeVInt(maxConcurrentGroupRequests);
if (out.getVersion().before(Version.V_6_0_0_alpha2_UNRELEASED)) { if (out.getVersion().before(Version.V_5_5_0_UNRELEASED)) {
final boolean hasInnerHit = innerHit != null; final boolean hasInnerHit = innerHit != null;
out.writeBoolean(hasInnerHit); out.writeBoolean(hasInnerHit);
if (hasInnerHit) { if (hasInnerHit) {

View File

@ -126,7 +126,7 @@ public class HasChildQueryBuilder extends AbstractQueryBuilder<HasChildQueryBuil
out.writeInt(maxChildren); out.writeInt(maxChildren);
out.writeVInt(scoreMode.ordinal()); out.writeVInt(scoreMode.ordinal());
out.writeNamedWriteable(query); out.writeNamedWriteable(query);
if (out.getVersion().before(Version.V_6_0_0_alpha2_UNRELEASED)) { if (out.getVersion().before(Version.V_5_5_0_UNRELEASED)) {
final boolean hasInnerHit = innerHitBuilder != null; final boolean hasInnerHit = innerHitBuilder != null;
out.writeBoolean(hasInnerHit); out.writeBoolean(hasInnerHit);
if (hasInnerHit) { if (hasInnerHit) {

View File

@ -121,7 +121,7 @@ public class HasParentQueryBuilder extends AbstractQueryBuilder<HasParentQueryBu
out.writeString(type); out.writeString(type);
out.writeBoolean(score); out.writeBoolean(score);
out.writeNamedWriteable(query); out.writeNamedWriteable(query);
if (out.getVersion().before(Version.V_6_0_0_alpha2_UNRELEASED)) { if (out.getVersion().before(Version.V_5_5_0_UNRELEASED)) {
final boolean hasInnerHit = innerHitBuilder != null; final boolean hasInnerHit = innerHitBuilder != null;
out.writeBoolean(hasInnerHit); out.writeBoolean(hasInnerHit);
if (hasInnerHit) { if (hasInnerHit) {