progress on testrandom... i think

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/lucene5666@1593794 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Muir 2014-05-11 14:12:45 +00:00
parent b7e7a8f3af
commit ac366755b6
1 changed files with 12 additions and 14 deletions

View File

@ -568,10 +568,14 @@ public class TestGrouping extends LuceneTestCase {
docs.add(doc); docs.add(doc);
if (groupValue.group != null) { if (groupValue.group != null) {
doc.add(newStringField("group", groupValue.group.utf8ToString(), Field.Store.YES)); doc.add(newStringField("group", groupValue.group.utf8ToString(), Field.Store.YES));
doc.add(new SortedDocValuesField("group", BytesRef.deepCopyOf(groupValue.group)));
} }
doc.add(newStringField("sort1", groupValue.sort1.utf8ToString(), Field.Store.NO)); doc.add(newStringField("sort1", groupValue.sort1.utf8ToString(), Field.Store.NO));
doc.add(new SortedDocValuesField("sort1", BytesRef.deepCopyOf(groupValue.sort1)));
doc.add(newStringField("sort2", groupValue.sort2.utf8ToString(), Field.Store.NO)); doc.add(newStringField("sort2", groupValue.sort2.utf8ToString(), Field.Store.NO));
doc.add(new SortedDocValuesField("sort2", BytesRef.deepCopyOf(groupValue.sort2)));
doc.add(new IntField("id", groupValue.id, Field.Store.NO)); doc.add(new IntField("id", groupValue.id, Field.Store.NO));
doc.add(new NumericDocValuesField("id", groupValue.id));
doc.add(newTextField("content", groupValue.content, Field.Store.NO)); doc.add(newTextField("content", groupValue.content, Field.Store.NO));
//System.out.println("TEST: doc content=" + groupValue.content + " group=" + (groupValue.group == null ? "null" : groupValue.group.utf8ToString()) + " sort1=" + groupValue.sort1.utf8ToString() + " id=" + groupValue.id); //System.out.println("TEST: doc content=" + groupValue.content + " group=" + (groupValue.group == null ? "null" : groupValue.group.utf8ToString()) + " sort1=" + groupValue.sort1.utf8ToString() + " id=" + groupValue.id);
} }
@ -671,16 +675,16 @@ public class TestGrouping extends LuceneTestCase {
new MockAnalyzer(random()))); new MockAnalyzer(random())));
Document doc = new Document(); Document doc = new Document();
Document docNoGroup = new Document(); Document docNoGroup = new Document();
Field idvGroupField = new SortedDocValuesField("group_dv", new BytesRef()); Field idvGroupField = new SortedDocValuesField("group", new BytesRef());
doc.add(idvGroupField); doc.add(idvGroupField);
docNoGroup.add(idvGroupField); docNoGroup.add(idvGroupField);
Field group = newStringField("group", "", Field.Store.NO); Field group = newStringField("group", "", Field.Store.NO);
doc.add(group); doc.add(group);
Field sort1 = newStringField("sort1", "", Field.Store.NO); Field sort1 = new SortedDocValuesField("sort1", new BytesRef());
doc.add(sort1); doc.add(sort1);
docNoGroup.add(sort1); docNoGroup.add(sort1);
Field sort2 = newStringField("sort2", "", Field.Store.NO); Field sort2 = new SortedDocValuesField("sort2", new BytesRef());
doc.add(sort2); doc.add(sort2);
docNoGroup.add(sort2); docNoGroup.add(sort2);
Field content = newTextField("content", "", Field.Store.NO); Field content = newTextField("content", "", Field.Store.NO);
@ -722,8 +726,8 @@ public class TestGrouping extends LuceneTestCase {
// we get null back instead of empty BytesRef: // we get null back instead of empty BytesRef:
idvGroupField.setBytesValue(new BytesRef()); idvGroupField.setBytesValue(new BytesRef());
} }
sort1.setStringValue(groupDoc.sort1.utf8ToString()); sort1.setBytesValue(BytesRef.deepCopyOf(groupDoc.sort1));
sort2.setStringValue(groupDoc.sort2.utf8ToString()); sort2.setBytesValue(BytesRef.deepCopyOf(groupDoc.sort2));
content.setStringValue(groupDoc.content); content.setStringValue(groupDoc.content);
id.setIntValue(groupDoc.id); id.setIntValue(groupDoc.id);
idDV.setLongValue(groupDoc.id); idDV.setLongValue(groupDoc.id);
@ -846,7 +850,7 @@ public class TestGrouping extends LuceneTestCase {
System.out.println("TEST: groupSort=" + groupSort + " docSort=" + docSort + " searchTerm=" + searchTerm + " dF=" + r.docFreq(new Term("content", searchTerm)) +" dFBlock=" + rBlocks.docFreq(new Term("content", searchTerm)) + " topNGroups=" + topNGroups + " groupOffset=" + groupOffset + " docOffset=" + docOffset + " doCache=" + doCache + " docsPerGroup=" + docsPerGroup + " doAllGroups=" + doAllGroups + " getScores=" + getScores + " getMaxScores=" + getMaxScores); System.out.println("TEST: groupSort=" + groupSort + " docSort=" + docSort + " searchTerm=" + searchTerm + " dF=" + r.docFreq(new Term("content", searchTerm)) +" dFBlock=" + rBlocks.docFreq(new Term("content", searchTerm)) + " topNGroups=" + topNGroups + " groupOffset=" + groupOffset + " docOffset=" + docOffset + " doCache=" + doCache + " docsPerGroup=" + docsPerGroup + " doAllGroups=" + doAllGroups + " getScores=" + getScores + " getMaxScores=" + getMaxScores);
} }
String groupField = "group_dv"; String groupField = "group";
if (VERBOSE) { if (VERBOSE) {
System.out.println(" groupField=" + groupField); System.out.println(" groupField=" + groupField);
} }
@ -1017,7 +1021,7 @@ public class TestGrouping extends LuceneTestCase {
} }
} }
assertEquals(docIDToID, expectedGroups, groupsResult, true, true, true, getScores, groupField.endsWith("_dv")); assertEquals(docIDToID, expectedGroups, groupsResult, true, true, true, getScores, true);
// Confirm merged shards match: // Confirm merged shards match:
assertEquals(docIDToID, expectedGroups, topGroupsShards, true, false, fillFields, getScores, idvBasedImplsUsedSharded.value); assertEquals(docIDToID, expectedGroups, topGroupsShards, true, false, fillFields, getScores, idvBasedImplsUsedSharded.value);
@ -1071,10 +1075,8 @@ public class TestGrouping extends LuceneTestCase {
} }
// Get shard'd block grouping result: // Get shard'd block grouping result:
// Block index does not index DocValues so we pass
// false for canUseIDV:
final TopGroups<BytesRef> topGroupsBlockShards = searchShards(sBlocks, shardsBlocks.subSearchers, query, final TopGroups<BytesRef> topGroupsBlockShards = searchShards(sBlocks, shardsBlocks.subSearchers, query,
groupSort, docSort, groupOffset, topNGroups, docOffset, docsPerGroup, getScores, getMaxScores, false, false, new ValueHolder<>(false)); groupSort, docSort, groupOffset, topNGroups, docOffset, docsPerGroup, getScores, getMaxScores, false, false, new ValueHolder<>(true));
if (expectedGroups != null) { if (expectedGroups != null) {
// Fixup scores for reader2 // Fixup scores for reader2
@ -1171,10 +1173,6 @@ public class TestGrouping extends LuceneTestCase {
} }
String groupField = "group"; String groupField = "group";
if (shardsCanUseIDV && random().nextBoolean()) {
groupField += "_dv";
usedIdvBasedImpl.value = true;
}
for(int shardIDX=0;shardIDX<subSearchers.length;shardIDX++) { for(int shardIDX=0;shardIDX<subSearchers.length;shardIDX++) {