mirror of https://github.com/apache/lucene.git
LUCENE-3590: cut over new DV grouping collectors
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1206156 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
7d5ad4b409
commit
233a289a66
|
@ -222,7 +222,7 @@ public abstract class DVAllGroupHeadsCollector<GH extends AbstractAllGroupHeadsC
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Comparable duplicate(Comparable value) {
|
protected Comparable duplicate(Comparable value) {
|
||||||
return new BytesRef((BytesRef) value);
|
return BytesRef.deepCopyOf((BytesRef) value);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setDocValuesSources(IndexDocValues.Source source) {
|
protected void setDocValuesSources(IndexDocValues.Source source) {
|
||||||
|
@ -248,7 +248,7 @@ public abstract class DVAllGroupHeadsCollector<GH extends AbstractAllGroupHeadsC
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Comparable duplicate(Comparable value) {
|
protected Comparable duplicate(Comparable value) {
|
||||||
return new BytesRef((BytesRef) value);
|
return BytesRef.deepCopyOf((BytesRef) value);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setDocValuesSources(IndexDocValues.Source source) {
|
protected void setDocValuesSources(IndexDocValues.Source source) {
|
||||||
|
|
|
@ -194,7 +194,7 @@ public abstract class DVAllGroupsCollector<GROUP_VALUE_TYPE> extends AbstractAll
|
||||||
public void collect(int doc) throws IOException {
|
public void collect(int doc) throws IOException {
|
||||||
BytesRef value = source.getBytes(doc, spare);
|
BytesRef value = source.getBytes(doc, spare);
|
||||||
if (!groups.contains(value)) {
|
if (!groups.contains(value)) {
|
||||||
groups.add(new BytesRef(value));
|
groups.add(BytesRef.deepCopyOf(value));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -154,10 +154,10 @@ public abstract class DVFirstPassGroupingCollector<GROUP_VALUE_TYPE> extends Abs
|
||||||
|
|
||||||
protected BytesRef copyDocGroupValue(BytesRef groupValue, BytesRef reuse) {
|
protected BytesRef copyDocGroupValue(BytesRef groupValue, BytesRef reuse) {
|
||||||
if (reuse != null) {
|
if (reuse != null) {
|
||||||
reuse.copy(groupValue);
|
reuse.copyBytes(groupValue);
|
||||||
return reuse;
|
return reuse;
|
||||||
} else {
|
} else {
|
||||||
return new BytesRef(groupValue);
|
return BytesRef.deepCopyOf(groupValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -184,10 +184,10 @@ public abstract class DVFirstPassGroupingCollector<GROUP_VALUE_TYPE> extends Abs
|
||||||
@Override
|
@Override
|
||||||
protected BytesRef copyDocGroupValue(BytesRef groupValue, BytesRef reuse) {
|
protected BytesRef copyDocGroupValue(BytesRef groupValue, BytesRef reuse) {
|
||||||
if (reuse != null) {
|
if (reuse != null) {
|
||||||
reuse.copy(groupValue);
|
reuse.copyBytes(groupValue);
|
||||||
return reuse;
|
return reuse;
|
||||||
} else {
|
} else {
|
||||||
return new BytesRef(groupValue);
|
return BytesRef.deepCopyOf(groupValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -748,7 +748,7 @@ public class TestGrouping extends LuceneTestCase {
|
||||||
if (groupDoc.group != null) {
|
if (groupDoc.group != null) {
|
||||||
group.setValue(groupDoc.group.utf8ToString());
|
group.setValue(groupDoc.group.utf8ToString());
|
||||||
if (canUseIDV) {
|
if (canUseIDV) {
|
||||||
idvGroupField.setBytes(new BytesRef(groupDoc.group), ValueType.BYTES_VAR_SORTED);
|
idvGroupField.setBytes(BytesRef.deepCopyOf(groupDoc.group), ValueType.BYTES_VAR_SORTED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sort1.setValue(groupDoc.sort1.utf8ToString());
|
sort1.setValue(groupDoc.sort1.utf8ToString());
|
||||||
|
|
Loading…
Reference in New Issue