Reader tokReader = field.readerValue();
/** * Disposes the document <code>old</code>. Closes any potentially open * readers held by the document. * * @param old * the document to dispose. */ public static void disposeDocument(Document old) { for (Fieldable f : old.getFields()) { try { if (f.readerValue() != null) { f.readerValue().close(); } else if (f instanceof LazyTextExtractorField) { LazyTextExtractorField field = (LazyTextExtractorField) f; field.dispose(); } } catch (IOException ex) { log.warn("Exception while disposing index document: " + ex); } } }
/** * Disposes the document <code>old</code>. Closes any potentially open * readers held by the document. * * @param old * the document to dispose. */ public static void disposeDocument(Document old) { for (Fieldable f : old.getFields()) { try { if (f.readerValue() != null) { f.readerValue().close(); } else if (f instanceof LazyTextExtractorField) { LazyTextExtractorField field = (LazyTextExtractorField) f; field.dispose(); } } catch (IOException ex) { log.warn("Exception while disposing index document: " + ex); } } }
/** * Disposes the document <code>old</code>. Closes any potentially open * readers held by the document. * * @param old the document to dispose. */ public static void disposeDocument(final Document old) { for (Iterator<Fieldable> it = old.getFields().iterator(); it.hasNext();) { Fieldable f = it.next(); try { if (f.readerValue() != null) { f.readerValue().close(); } else if (f instanceof TextFieldExtractor) { TextFieldExtractor field = (TextFieldExtractor)f; field.dispose(); } } catch (IOException ex) { log.warn("Exception while disposing index document: " + ex); } } }
/** * Serialize the value into the given {@link ObjectOutput} * @param out the stream in which we serialize the value * @param field the field from which we extract the value * @throws IOException if the value could not be serialized */ private static void writeValue(ObjectOutput out, Fieldable field) throws IOException { Object o = field.stringValue(); if (o != null) { // Use writeObject instead of writeUTF because the value could contain unsupported // characters out.writeObject(o); return; } o = field.tokenStreamValue(); if (o != null) { out.writeObject(o); return; } o = field.readerValue(); throw new RuntimeException("Unsupported value " + o); }
Field.Store stored = f.isStored() ? Field.Store.YES : Field.Store.NO; Field.Index indexed = getIndexParameter(f); if (f instanceof LazyTextExtractorField || f.readerValue() != null) {
Field.Store stored = f.isStored() ? Field.Store.YES : Field.Store.NO; Field.Index indexed = getIndexParameter(f); if (f instanceof LazyTextExtractorField || f.readerValue() != null) {
final Reader readerValue = field.readerValue();
final Reader readerValue = field.readerValue();