Invoke super.clone() instead of creating a new instance in the clone methods.
This commit is contained in:
parent
7380a0a65a
commit
9001874a47
|
@ -51,7 +51,7 @@ import java.util.Set;
|
|||
public class ChildrenConstantScoreQuery extends Query {
|
||||
|
||||
private final ParentChildIndexFieldData parentChildIndexFieldData;
|
||||
private final Query originalChildQuery;
|
||||
private Query originalChildQuery;
|
||||
private final String parentType;
|
||||
private final String childType;
|
||||
private final Filter parentFilter;
|
||||
|
@ -88,12 +88,10 @@ public class ChildrenConstantScoreQuery extends Query {
|
|||
|
||||
@Override
|
||||
public Query clone() {
|
||||
ChildrenConstantScoreQuery q = new ChildrenConstantScoreQuery(parentChildIndexFieldData, originalChildQuery.clone(),
|
||||
parentType, childType, parentFilter, shortCircuitParentDocSet, nonNestedDocsFilter);
|
||||
q.setBoost(getBoost());
|
||||
ChildrenConstantScoreQuery q = (ChildrenConstantScoreQuery) super.clone();
|
||||
q.originalChildQuery = originalChildQuery.clone();
|
||||
if (q.rewrittenChildQuery != null) {
|
||||
q.rewrittenChildQuery = rewrittenChildQuery.clone();
|
||||
q.rewriteIndexReader = rewriteIndexReader;
|
||||
}
|
||||
return q;
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ public class ChildrenQuery extends Query {
|
|||
private final String childType;
|
||||
private final Filter parentFilter;
|
||||
private final ScoreType scoreType;
|
||||
private final Query originalChildQuery;
|
||||
private Query originalChildQuery;
|
||||
private final int shortCircuitParentDocSet;
|
||||
private final Filter nonNestedDocsFilter;
|
||||
|
||||
|
@ -131,12 +131,10 @@ public class ChildrenQuery extends Query {
|
|||
|
||||
@Override
|
||||
public Query clone() {
|
||||
ChildrenQuery q = new ChildrenQuery(parentChildIndexFieldData, parentType, childType, parentFilter,
|
||||
originalChildQuery, scoreType, shortCircuitParentDocSet, nonNestedDocsFilter);
|
||||
q.setBoost(getBoost());
|
||||
ChildrenQuery q = (ChildrenQuery) super.clone();
|
||||
q.originalChildQuery = originalChildQuery.clone();
|
||||
if (q.rewrittenChildQuery != null) {
|
||||
q.rewrittenChildQuery = rewrittenChildQuery.clone();
|
||||
q.rewriteIndexReader = rewriteIndexReader;
|
||||
}
|
||||
return q;
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ import java.util.Set;
|
|||
public class ParentConstantScoreQuery extends Query {
|
||||
|
||||
private final ParentChildIndexFieldData parentChildIndexFieldData;
|
||||
private final Query originalParentQuery;
|
||||
private Query originalParentQuery;
|
||||
private final String parentType;
|
||||
private final Filter childrenFilter;
|
||||
|
||||
|
@ -77,12 +77,10 @@ public class ParentConstantScoreQuery extends Query {
|
|||
|
||||
@Override
|
||||
public Query clone() {
|
||||
ParentConstantScoreQuery q = new ParentConstantScoreQuery(parentChildIndexFieldData, originalParentQuery,
|
||||
parentType, childrenFilter);
|
||||
q.setBoost(getBoost());
|
||||
ParentConstantScoreQuery q = (ParentConstantScoreQuery) super.clone();
|
||||
q.originalParentQuery = originalParentQuery.clone();
|
||||
if (q.rewrittenParentQuery != null) {
|
||||
q.rewrittenParentQuery = rewrittenParentQuery.clone();
|
||||
q.rewriteIndexReader = rewriteIndexReader;
|
||||
}
|
||||
return q;
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ import java.util.Set;
|
|||
public class ParentQuery extends Query {
|
||||
|
||||
private final ParentChildIndexFieldData parentChildIndexFieldData;
|
||||
private final Query originalParentQuery;
|
||||
private Query originalParentQuery;
|
||||
private final String parentType;
|
||||
private final Filter childrenFilter;
|
||||
|
||||
|
@ -122,11 +122,10 @@ public class ParentQuery extends Query {
|
|||
|
||||
@Override
|
||||
public Query clone() {
|
||||
ParentQuery q = new ParentQuery(parentChildIndexFieldData, originalParentQuery, parentType, childrenFilter);
|
||||
q.setBoost(getBoost());
|
||||
ParentQuery q = (ParentQuery) super.clone();
|
||||
q.originalParentQuery = originalParentQuery.clone();
|
||||
if (q.rewrittenParentQuery != null) {
|
||||
q.rewrittenParentQuery = rewrittenParentQuery.clone();
|
||||
q.rewriteIndexReader = rewriteIndexReader;
|
||||
}
|
||||
return q;
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ public class TopChildrenQuery extends Query {
|
|||
private final ScoreType scoreType;
|
||||
private final int factor;
|
||||
private final int incrementalFactor;
|
||||
private final Query originalChildQuery;
|
||||
private Query originalChildQuery;
|
||||
private final Filter nonNestedDocsFilter;
|
||||
|
||||
// This field will hold the rewritten form of originalChildQuery, so that we can reuse it
|
||||
|
@ -108,14 +108,10 @@ public class TopChildrenQuery extends Query {
|
|||
|
||||
@Override
|
||||
public Query clone() {
|
||||
TopChildrenQuery q = new TopChildrenQuery(
|
||||
parentChildIndexFieldData, originalChildQuery.clone(), childType, parentType,
|
||||
scoreType, factor, incrementalFactor, cacheRecycler, nonNestedDocsFilter
|
||||
);
|
||||
q.setBoost(getBoost());
|
||||
TopChildrenQuery q = (TopChildrenQuery) super.clone();
|
||||
q.originalChildQuery = originalChildQuery.clone();
|
||||
if (q.rewrittenChildQuery != null) {
|
||||
q.rewrittenChildQuery = rewrittenChildQuery.clone();
|
||||
q.rewriteIndexReader = rewriteIndexReader;
|
||||
}
|
||||
return q;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue