Java Code Examples for org.apache.lucene.index.DocValues#getBinary()
The following examples show how to use
org.apache.lucene.index.DocValues#getBinary() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SerializedDVStrategy.java From lucene-solr with Apache License 2.0 | 6 votes |
@Override public ShapeValues getValues(LeafReaderContext readerContext) throws IOException { final BinaryDocValues docValues = DocValues.getBinary(readerContext.reader(), fieldName); return new ShapeValues() { @Override public boolean advanceExact(int doc) throws IOException { return docValues.advanceExact(doc); } @Override public Shape value() throws IOException { BytesRef bytesRef = docValues.binaryValue(); DataInputStream dataInput = new DataInputStream(new ByteArrayInputStream(bytesRef.bytes, bytesRef.offset, bytesRef.length)); return binaryCodec.readShape(dataInput); } }; }
Example 2
Source File: AbstractGeoPointDVIndexFieldData.java From Elasticsearch with Apache License 2.0 | 5 votes |
@Override public AtomicGeoPointFieldData load(LeafReaderContext context) { try { if (indexCreatedBefore2x) { return new GeoPointLegacyDVAtomicFieldData(DocValues.getBinary(context.reader(), fieldNames.indexName())); } return new GeoPointDVAtomicFieldData(DocValues.getSortedNumeric(context.reader(), fieldNames.indexName())); } catch (IOException e) { throw new IllegalStateException("Cannot load doc values", e); } }
Example 3
Source File: BytesBinaryDVIndexFieldData.java From Elasticsearch with Apache License 2.0 | 5 votes |
@Override public BytesBinaryDVAtomicFieldData load(LeafReaderContext context) { try { return new BytesBinaryDVAtomicFieldData(DocValues.getBinary(context.reader(), fieldNames.indexName())); } catch (IOException e) { throw new IllegalStateException("Cannot load doc values", e); } }
Example 4
Source File: BinaryDVAtomicFieldData.java From Elasticsearch with Apache License 2.0 | 5 votes |
@Override public SortedBinaryDocValues getBytesValues() { try { final BinaryDocValues values = DocValues.getBinary(reader, field); final Bits docsWithField = DocValues.getDocsWithField(reader, field); return FieldData.singleton(values, docsWithField); } catch (IOException e) { throw new IllegalStateException("Cannot load doc values", e); } }
Example 5
Source File: AlfrescoCollatableTextFieldType.java From SearchServices with GNU Lesser General Public License v3.0 | 5 votes |
@Override public LeafFieldComparator getLeafComparator(LeafReaderContext context) throws IOException { docTerms = DocValues.getBinary(context.reader(), field); docsWithField = DocValues.getDocsWithField(context.reader(), field); if (docsWithField instanceof Bits.MatchAllBits) { docsWithField = null; } return this; }
Example 6
Source File: AlfrescoCollatableMLTextFieldType.java From SearchServices with GNU Lesser General Public License v3.0 | 5 votes |
@Override public LeafFieldComparator getLeafComparator(LeafReaderContext context) throws IOException { docTerms = DocValues.getBinary(context.reader(), field); docsWithField = DocValues.getDocsWithField(context.reader(), field); if (docsWithField instanceof Bits.MatchAllBits) { docsWithField = null; } return this; }
Example 7
Source File: JoinDocFreqValueSource.java From lucene-solr with Apache License 2.0 | 5 votes |
@Override public FunctionValues getValues(Map<Object, Object> context, LeafReaderContext readerContext) throws IOException { final BinaryDocValues terms = DocValues.getBinary(readerContext.reader(), field); final IndexReader top = ReaderUtil.getTopLevelContext(readerContext).reader(); Terms t = MultiTerms.getTerms(top, qfield); final TermsEnum termsEnum = t == null ? TermsEnum.EMPTY : t.iterator(); return new IntDocValues(this) { int lastDocID = -1; @Override public int intVal(int doc) throws IOException { if (doc < lastDocID) { throw new IllegalArgumentException("docs were sent out-of-order: lastDocID=" + lastDocID + " vs docID=" + doc); } lastDocID = doc; int curDocID = terms.docID(); if (doc > curDocID) { curDocID = terms.advance(doc); } if (doc == curDocID) { BytesRef term = terms.binaryValue(); if (termsEnum.seekExact(term)) { return termsEnum.docFreq(); } } return 0; } }; }
Example 8
Source File: BinaryDVNumericIndexFieldData.java From Elasticsearch with Apache License 2.0 | 4 votes |
@Override public AtomicNumericFieldData load(LeafReaderContext context) { try { final BinaryDocValues values = DocValues.getBinary(context.reader(), fieldNames.indexName()); if (numericType.isFloatingPoint()) { return new AtomicDoubleFieldData(-1) { @Override public SortedNumericDoubleValues getDoubleValues() { switch (numericType) { case FLOAT: return new BinaryAsSortedNumericFloatValues(values); case DOUBLE: return new BinaryAsSortedNumericDoubleValues(values); default: throw new IllegalArgumentException("" + numericType); } } @Override public Collection<Accountable> getChildResources() { return Collections.emptyList(); } }; } else { return new AtomicLongFieldData(0) { @Override public SortedNumericDocValues getLongValues() { return new BinaryAsSortedNumericDocValues(values); } @Override public Collection<Accountable> getChildResources() { return Collections.emptyList(); } }; } } catch (IOException e) { throw new IllegalStateException("Cannot load doc values", e); } }
Example 9
Source File: TestDiversifiedTopDocsCollector.java From lucene-solr with Apache License 2.0 | 4 votes |
@Override public LeafCollector getLeafCollector(LeafReaderContext context) throws IOException { this.vals = DocValues.getBinary(context.reader(), field); return super.getLeafCollector(context); }
Example 10
Source File: DocValuesTermsCollector.java From lucene-solr with Apache License 2.0 | 4 votes |
static Function<BinaryDocValues> binaryDocValues(String field) { return (ctx) -> DocValues.getBinary(ctx, field); }
Example 11
Source File: FieldComparator.java From lucene-solr with Apache License 2.0 | 4 votes |
/** Retrieves the BinaryDocValues for the field in this segment */ protected BinaryDocValues getBinaryDocValues(LeafReaderContext context, String field) throws IOException { return DocValues.getBinary(context.reader(), field); }
Example 12
Source File: StringField.java From lucene-solr with Apache License 2.0 | 4 votes |
@Override public void doSetNextReader(LeafReaderContext context) throws IOException { docValues = DocValues.getBinary(context.reader(), fieldName); }
Example 13
Source File: SequenceSorter.java From HongsCORE with MIT License | 4 votes |
@Override protected void doSetNextReader(LeafReader r ) throws IOException { docs = DocValues.getBinary(r, name); }
Example 14
Source File: IntervalSorter.java From HongsCORE with MIT License | 4 votes |
@Override protected void doSetNextReader(LeafReader r) throws IOException { docs = DocValues.getBinary(r, name); }
Example 15
Source File: DistanceSorter.java From HongsCORE with MIT License | 4 votes |
@Override protected void doSetNextReader(LeafReader r) throws IOException { docs = DocValues.getBinary(r, name); }
Example 16
Source File: DurationSorter.java From HongsCORE with MIT License | 4 votes |
@Override protected void doSetNextReader(LeafReader r) throws IOException { docs = DocValues.getBinary(r, name); }