/** * Returns an array of bytes for the first (or only) field that has the name * specified as the method parameter. This method will return <code>null</code> * if no binary fields with the specified name are available. * There may be non-binary fields with the same name. * * @param name the name of the field. * @return a <code>BytesRef</code> containing the binary field value or <code>null</code> */ public final BytesRef getBinaryValue(String name) { for (IndexableField field : fields) { if (field.name().equals(name)) { final BytesRef bytes = field.binaryValue(); if (bytes != null) { return bytes; } } } return null; }
/** * Returns an array of byte arrays for of the fields that have the name specified * as the method parameter. This method returns an empty * array when there are no matching fields. It never * returns null. * * @param name the name of the field * @return a <code>BytesRef[]</code> of binary field values */ public final BytesRef[] getBinaryValues(String name) { final List<BytesRef> result = new ArrayList<>(); for (IndexableField field : fields) { if (field.name().equals(name)) { final BytesRef bytes = field.binaryValue(); if (bytes != null) { result.add(bytes); } } } return result.toArray(new BytesRef[result.size()]); }
/** * Extract the Apache Geode key term from a lucene document */ public static Term getKeyTerm(Document doc) { IndexableField field = doc.getField(KEY_FIELD); if (field.stringValue() != null) { return new Term(KEY_FIELD, field.stringValue()); } else { return new Term(KEY_FIELD, field.binaryValue()); } }
/** * Extract the Apache Geode key from a lucene document */ public static Object getKey(Document doc) { IndexableField field = doc.getField(KEY_FIELD); if (field.stringValue() != null) { return field.stringValue(); } else { return keyFromBytes(field.binaryValue()); } }
objser.binaryValue().bytes); } catch (ClassNotFoundException ex) {
IndexableField tags = doc.getField(QueryBuilder.TAGS); if (tags != null) { return Definitions.deserialize(tags.binaryValue().bytes);
IndexableField tagsField = doc.getField(QueryBuilder.TAGS); if (tagsField != null) { tags = Definitions.deserialize(tagsField.binaryValue().bytes); scopes = Scopes.deserialize(scopesField.binaryValue().bytes); } else { scopes = new Scopes();
IndexableField tagsField = doc.getField(QueryBuilder.TAGS); if (tagsField != null) { tags = Definitions.deserialize(tagsField.binaryValue().bytes); scopes = Scopes.deserialize(scopesField.binaryValue().bytes);
bytes = null; } else { bytes = field.binaryValue(); if (bytes != null) { bits = BYTE_ARR;
Document doc = searcher.doc(hits[0].doc); if (doc.getField(QueryBuilder.TAGS) != null) { byte[] rawTags = doc.getField(QueryBuilder.TAGS).binaryValue().bytes; Definitions tags = Definitions.deserialize(rawTags); String symbol = ((TermQuery) query).getTerm().text();
fp.docValuesWriter = new BinaryDocValuesWriter(fp.fieldInfo, bytesUsed); ((BinaryDocValuesWriter) fp.docValuesWriter).addValue(docID, field.binaryValue()); break; fp.docValuesWriter = new SortedDocValuesWriter(fp.fieldInfo, bytesUsed); ((SortedDocValuesWriter) fp.docValuesWriter).addValue(docID, field.binaryValue()); break; fp.docValuesWriter = new SortedSetDocValuesWriter(fp.fieldInfo, bytesUsed); ((SortedSetDocValuesWriter) fp.docValuesWriter).addValue(docID, field.binaryValue()); break;
IndexableField tagsField = doc.getField(QueryBuilder.TAGS); if (tagsField != null) { tags = Definitions.deserialize(tagsField.binaryValue().bytes); IndexableField scopesField = doc.getField(QueryBuilder.SCOPES); if (scopesField != null) { scopes = Scopes.deserialize(scopesField.binaryValue().bytes); } else { scopes = new Scopes();
/** Called from processDocument to index one field's point */ private void indexPoint(PerField fp, IndexableField field) throws IOException { int pointDataDimensionCount = field.fieldType().pointDataDimensionCount(); int pointIndexDimensionCount = field.fieldType().pointIndexDimensionCount(); int dimensionNumBytes = field.fieldType().pointNumBytes(); // Record dimensions for this field; this setter will throw IllegalArgExc if // the dimensions were already set to something different: if (fp.fieldInfo.getPointDataDimensionCount() == 0) { fieldInfos.globalFieldNumbers.setDimensions(fp.fieldInfo.number, fp.fieldInfo.name, pointDataDimensionCount, pointIndexDimensionCount, dimensionNumBytes); } fp.fieldInfo.setPointDimensions(pointDataDimensionCount, pointIndexDimensionCount, dimensionNumBytes); if (fp.pointValuesWriter == null) { fp.pointValuesWriter = new PointValuesWriter(docWriter, fp.fieldInfo); } fp.pointValuesWriter.addPackedValue(docState.docID, field.binaryValue()); }
analyzer.analyze(doc, getStreamSource(path), xrefOut); Definitions definitions = Definitions.deserialize(doc.getField(QueryBuilder.TAGS).binaryValue().bytes);
public BytesRef getBinaryValue(String name) { for (IndexableField f : fields) { if (f.name().equals(name) && f.binaryValue() != null) { return f.binaryValue(); } } return null; }
analyzer.analyze(doc, getStreamSource(path), xrefOut); Definitions definitions = Definitions.deserialize(doc.getField(QueryBuilder.TAGS).binaryValue().bytes); assertNotNull(definitions); String[] type = new String[1];
Scopes scopes = Scopes.deserialize(scopesField.binaryValue().bytes); Scope globalScope = scopes.getScope(-1); assertEquals(3, scopes.size()); // foo, bar, main
Scopes scopes = Scopes.deserialize(scopesField.binaryValue().bytes); Scope globalScope = scopes.getScope(-1); assertEquals(4, scopes.size()); //TODO 5
Scopes scopes = Scopes.deserialize(scopesField.binaryValue().bytes); Scope globalScope = scopes.getScope(-1); assertEquals(5, scopes.size()); // foo, bar, main
Scopes scopes = Scopes.deserialize(scopesField.binaryValue().bytes); Scope globalScope = scopes.getScope(-1); assertEquals(9, scopes.size());