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:
Robert Muir 2011-11-25 13:28:43 +00:00
parent 7d5ad4b409
commit 233a289a66
4 changed files with 8 additions and 8 deletions

View File

@ -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) {

View File

@ -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));
} }
} }

View File

@ -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);
} }
} }

View File

@ -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());