@Override public boolean isFloatingPoint() { return indexFieldData.getNumericType().isFloatingPoint(); }
/** * gets the field data type from the _indexFieldData object * @return */ private Constants.FIELD_DATA_TYPE getType() { final boolean numericField = (_indexFieldData instanceof IndexNumericFieldData); FIELD_DATA_TYPE type = FIELD_DATA_TYPE.STRING; if(numericField) { final IndexNumericFieldData<?> indexNumericFieldData = (IndexNumericFieldData<?>) _indexFieldData; if(indexNumericFieldData.getNumericType() == IndexNumericFieldData.NumericType.LONG) type = FIELD_DATA_TYPE.LONG; if(indexNumericFieldData.getNumericType() == IndexNumericFieldData.NumericType.INT) type = FIELD_DATA_TYPE.INT; } return type; }
scriptValues = data.getLegacyFieldValues(); } else if (indexFieldData instanceof IndexNumericFieldData) { if (((IndexNumericFieldData) indexFieldData).getNumericType().isFloatingPoint()) { doubleValues = ((AtomicNumericFieldData) data).getDoubleValues(); } else {
@Override public boolean isFloatingPoint() { return indexFieldData.getNumericType().isFloatingPoint(); }
@Override public boolean isFloatingPoint() { return indexFieldData.getNumericType().isFloatingPoint(); }
@Override public boolean isFloatingPoint() { return indexFieldData.getNumericType().isFloatingPoint(); }
@Override public boolean isFloatingPoint() { return indexFieldData.getNumericType().isFloatingPoint(); }
@Override public Post post() { // TODO would we need to implement filtering separately at this stage? From SearchContext? //check the data type of the field //if it is numeric, get the type and pass the information to the PostExecutor //otherwise, handle strings final boolean numericField = (_indexFieldData instanceof IndexNumericFieldData); FIELD_DATA_TYPE type = FIELD_DATA_TYPE.STRING; if(numericField) { final IndexNumericFieldData<?> indexNumericFieldData = (IndexNumericFieldData<?>) _indexFieldData; if(indexNumericFieldData.getNumericType() == IndexNumericFieldData.NumericType.LONG) type = FIELD_DATA_TYPE.LONG; if(indexNumericFieldData.getNumericType() == IndexNumericFieldData.NumericType.INT) type = FIELD_DATA_TYPE.INT; } return new PostExecutor(_indexFieldData.getFieldNames().name(), numericField, type); //throw new UnsupportedOperationException("Post aggregation is not yet supported"); }
/** * Instantiates a new reusable {@link BytesRefTermStream} based on the field type. */ public static BytesRefTermStream get(IndexReader reader, IndexFieldData indexFieldData) { if (indexFieldData instanceof IndexNumericFieldData) { IndexNumericFieldData numFieldData = (IndexNumericFieldData) indexFieldData; switch (numFieldData.getNumericType()) { case INT: return new IntegerBytesRefTermStream(reader, numFieldData); case LONG: return new LongBytesRefTermStream(reader, numFieldData); default: throw new UnsupportedOperationException("Streaming numeric type '" + numFieldData.getNumericType().name() + "' is unsupported"); } } else { return new BytesBytesRefTermStream(reader, indexFieldData); } }
/** * Instantiates a new reusable {@link NumericTermStream} based on the field type. */ public static NumericTermStream get(IndexReader reader, IndexFieldData indexFieldData) { if (indexFieldData instanceof IndexNumericFieldData) { IndexNumericFieldData numFieldData = (IndexNumericFieldData) indexFieldData; if (!numFieldData.getNumericType().isFloatingPoint()) { return new LongTermStream(reader, numFieldData); } else { throw new UnsupportedOperationException("Streaming floating points is unsupported"); } } else { return new HashTermStream(reader, indexFieldData); } }
scriptValues = data.getScriptValues(); } else if (indexFieldData instanceof IndexNumericFieldData) { if (((IndexNumericFieldData) indexFieldData).getNumericType().isFloatingPoint()) { doubleValues = ((AtomicNumericFieldData) data).getDoubleValues(); } else {
scriptValues = data.getLegacyFieldValues(); } else if (indexFieldData instanceof IndexNumericFieldData) { if (((IndexNumericFieldData) indexFieldData).getNumericType().isFloatingPoint()) { doubleValues = ((AtomicNumericFieldData) data).getDoubleValues(); } else {
@Override public DocIdSet getDocIdSet(LeafReaderContext context) throws IOException { final NumericTermsSet termsSet = this.getTermsSet(); // make sure there are terms to filter on if (termsSet == null || termsSet.isEmpty()) return null; IndexNumericFieldData numericFieldData = (IndexNumericFieldData) fieldData; if (!numericFieldData.getNumericType().isFloatingPoint()) { final SortedNumericDocValues values = numericFieldData.load(context).getLongValues(); // load fielddata return new DocValuesDocIdSet(context.reader().maxDoc(), context.reader().getLiveDocs()) { @Override protected boolean matchDoc(int doc) { values.setDocument(doc); final int numVals = values.count(); for (int i = 0; i < numVals; i++) { if (termsSet.contains(values.valueAt(i))) { return true; } } return false; } }; } // only get here if wrong fielddata type in which case // no docs will match so we just return null. return null; }