@Override public ValueFiller getValueFiller() { return new ValueFiller() { private final MutableValueBool mval = new MutableValueBool(); @Override public MutableValue getValue() { return mval; } @Override public void fillValue(int doc) { mval.value = boolVal(doc); mval.exists = exists(doc); } }; }
@Override public ValueFiller getValueFiller() { return new ValueFiller() { private final MutableValueFloat mval = new MutableValueFloat(); @Override public MutableValue getValue() { return mval; } @Override public void fillValue(int doc) { mval.value = floatVal(doc); mval.exists = exists(doc); } }; }
@Override public ValueFiller getValueFiller() { return new ValueFiller() { private final MutableValueLong mval = new MutableValueLong(); @Override public MutableValue getValue() { return mval; } @Override public void fillValue(int doc) { mval.value = longVal(doc); mval.exists = exists(doc); } }; }
@Override public ValueFiller getValueFiller() { return new ValueFiller() { private final MutableValueStr mval = new MutableValueStr(); @Override public MutableValue getValue() { return mval; } @Override public void fillValue(int doc) { int ord = termsIndex.getOrd(doc); mval.value.length = 0; mval.exists = ord >= 0; if (mval.exists) { mval.value.copyBytes(termsIndex.lookupOrd(ord)); } } }; }
@Override public ValueFiller getValueFiller() { return new ValueFiller() { private final MutableValueInt mval = new MutableValueInt(); @Override public MutableValue getValue() { return mval; } @Override public void fillValue(int doc) { mval.value = intVal(doc); mval.exists = exists(doc); } }; }
@Override public ValueFiller getValueFiller() { return new ValueFiller() { private final MutableValueStr mval = new MutableValueStr(); @Override public MutableValue getValue() { return mval; } @Override public void fillValue(int doc) { mval.exists = bytesVal(doc, mval.value); } }; }
@Override public ValueFiller getValueFiller() { return new ValueFiller() { private final MutableValueDouble mval = new MutableValueDouble(); @Override public MutableValue getValue() { return mval; } @Override public void fillValue(int doc) { mval.value = doubleVal(doc); mval.exists = exists(doc); } }; }
/** @lucene.experimental */ public ValueFiller getValueFiller() { return new ValueFiller() { private final MutableValueFloat mval = new MutableValueFloat(); @Override public MutableValue getValue() { return mval; } @Override public void fillValue(int doc) { mval.value = floatVal(doc); } }; }
private Collection<SearchGroup<BytesRef>> getSearchGroups(AbstractFirstPassGroupingCollector<?> c, int groupOffset, boolean fillFields) { if (TermFirstPassGroupingCollector.class.isAssignableFrom(c.getClass())) { return ((TermFirstPassGroupingCollector) c).getTopGroups(groupOffset, fillFields); } else if (FunctionFirstPassGroupingCollector.class.isAssignableFrom(c.getClass())) { Collection<SearchGroup<MutableValue>> mutableValueGroups = ((FunctionFirstPassGroupingCollector) c).getTopGroups(groupOffset, fillFields); if (mutableValueGroups == null) { return null; } List<SearchGroup<BytesRef>> groups = new ArrayList<>(mutableValueGroups.size()); for (SearchGroup<MutableValue> mutableValueGroup : mutableValueGroups) { SearchGroup<BytesRef> sg = new SearchGroup<>(); sg.groupValue = mutableValueGroup.groupValue.exists() ? ((MutableValueStr) mutableValueGroup.groupValue).value : null; sg.sortValues = mutableValueGroup.sortValues; groups.add(sg); } return groups; } fail(); return null; }
@SuppressWarnings({"unchecked", "rawtypes"}) private TopGroups<BytesRef> getTopGroups(AbstractSecondPassGroupingCollector c, int withinGroupOffset) { if (c.getClass().isAssignableFrom(TermSecondPassGroupingCollector.class)) { return ((TermSecondPassGroupingCollector) c).getTopGroups(withinGroupOffset); } else if (c.getClass().isAssignableFrom(FunctionSecondPassGroupingCollector.class)) { TopGroups<MutableValue> mvalTopGroups = ((FunctionSecondPassGroupingCollector) c).getTopGroups(withinGroupOffset); List<GroupDocs<BytesRef>> groups = new ArrayList<>(mvalTopGroups.groups.length); for (GroupDocs<MutableValue> mvalGd : mvalTopGroups.groups) { BytesRef groupValue = mvalGd.groupValue.exists() ? ((MutableValueStr) mvalGd.groupValue).value : null; groups.add(new GroupDocs<>(Float.NaN, mvalGd.maxScore, mvalGd.totalHits, mvalGd.scoreDocs, groupValue, mvalGd.groupSortValues)); } return new TopGroups<>(mvalTopGroups.groupSort, mvalTopGroups.withinGroupSort, mvalTopGroups.totalHitCount, mvalTopGroups.totalGroupedHitCount, groups.toArray(new GroupDocs[groups.size()]), Float.NaN); } fail(); return null; }
private void compareNull(Object groupValue) { if (groupValue == null) { return; // term based impl... } // DV based impls.. if (BytesRef.class.isAssignableFrom(groupValue.getClass())) { assertEquals("", ((BytesRef) groupValue).utf8ToString()); } else if (Double.class.isAssignableFrom(groupValue.getClass())) { assertEquals(0.0d, groupValue); } else if (Long.class.isAssignableFrom(groupValue.getClass())) { assertEquals(0L, groupValue); // Function based impl } else if (MutableValue.class.isAssignableFrom(groupValue.getClass())) { assertFalse(((MutableValue) groupValue).exists()); } else { fail(); } }
@Override public ValueFiller getValueFiller() { return new ValueFiller() { private final MutableValueStr mval = new MutableValueStr(); @Override public MutableValue getValue() { return mval; } @Override public void fillValue(int doc) { termsIndex.get(doc, mval.value); mval.exists = mval.value.bytes != SortedDocValues.MISSING; } }; }
private Collection<SearchGroup<BytesRef>> getSearchGroups(AbstractFirstPassGroupingCollector<?> c, int groupOffset, boolean fillFields) { if (TermFirstPassGroupingCollector.class.isAssignableFrom(c.getClass())) { return ((TermFirstPassGroupingCollector) c).getTopGroups(groupOffset, fillFields); } else if (FunctionFirstPassGroupingCollector.class.isAssignableFrom(c.getClass())) { Collection<SearchGroup<MutableValue>> mutableValueGroups = ((FunctionFirstPassGroupingCollector) c).getTopGroups(groupOffset, fillFields); if (mutableValueGroups == null) { return null; } List<SearchGroup<BytesRef>> groups = new ArrayList<SearchGroup<BytesRef>>(mutableValueGroups.size()); for (SearchGroup<MutableValue> mutableValueGroup : mutableValueGroups) { SearchGroup<BytesRef> sg = new SearchGroup<BytesRef>(); sg.groupValue = mutableValueGroup.groupValue.exists() ? ((MutableValueStr) mutableValueGroup.groupValue).value : null; sg.sortValues = mutableValueGroup.sortValues; groups.add(sg); } return groups; } fail(); return null; }
@SuppressWarnings({"unchecked", "rawtypes"}) private TopGroups<BytesRef> getTopGroups(AbstractSecondPassGroupingCollector c, int withinGroupOffset) { if (c.getClass().isAssignableFrom(TermSecondPassGroupingCollector.class)) { return ((TermSecondPassGroupingCollector) c).getTopGroups(withinGroupOffset); } else if (c.getClass().isAssignableFrom(FunctionSecondPassGroupingCollector.class)) { TopGroups<MutableValue> mvalTopGroups = ((FunctionSecondPassGroupingCollector) c).getTopGroups(withinGroupOffset); List<GroupDocs<BytesRef>> groups = new ArrayList<GroupDocs<BytesRef>>(mvalTopGroups.groups.length); for (GroupDocs<MutableValue> mvalGd : mvalTopGroups.groups) { BytesRef groupValue = mvalGd.groupValue.exists() ? ((MutableValueStr) mvalGd.groupValue).value : null; groups.add(new GroupDocs<BytesRef>(Float.NaN, mvalGd.maxScore, mvalGd.totalHits, mvalGd.scoreDocs, groupValue, mvalGd.groupSortValues)); } return new TopGroups<BytesRef>(mvalTopGroups.groupSort, mvalTopGroups.withinGroupSort, mvalTopGroups.totalHitCount, mvalTopGroups.totalGroupedHitCount, groups.toArray(new GroupDocs[groups.size()]), Float.NaN); } fail(); return null; }
@Override public ValueFiller getValueFiller() { return new ValueFiller() { private final MutableValueStr mval = new MutableValueStr(); @Override public MutableValue getValue() { return mval; } @Override public void fillValue(int doc) { int ord = termsIndex.getOrd(doc); if (ord == -1) { mval.value.bytes = BytesRef.EMPTY_BYTES; mval.value.offset = 0; mval.value.length = 0; mval.exists = false; } else { termsIndex.lookupOrd(ord, mval.value); mval.exists = true; } } }; }