I think I like this decoupling ... for normal users I don't think this
makes the API harder? They still work with TextField, FloatField,
StoredField, etc.? It's just that, under the hood, these sugar classes
extend from the right base class (indexed or stored).
Document.add is just type overloaded, but Document.get* will get
messier: we'll need getStored and getIndexed? I guess that would be
simpler if Document could just store Field instances... hmm.
It would also be less invasive change for migrating from 4.0 -> 5.0
(assuming this issue is done only for 5.0...) if we didn't do the hard
split.... else we need a back-compat story...
We already have Document and it's going to become confusing with two different Document classes
+1 to use a better name (LuceneDocument? AbstractDocument?).
Maybe IndexDocument? I think it's OK as an interface if we mark it
@lucene.internal? This is the raw, super expert low-level that indexer
uses to consume documents... it has only 2 methods, and I think for
expert users it could be a hassle if we force the impl to inherit from
our base class...
Should StoredDocument (returned from IR.document) be "read only"? Like
you can iterate its fields, look them up, etc., but not eg remove them?
We should probably rename document.Field -> document.IndexedField and
document.Field -> document.IndexedFieldType?
Also I think we should rename XXXField.TYPE_UNSTORED -> .TYPE, since in
each case there's only 1 TYPE instance for that sugar field?
Separately, I think even for 4.0 we should remove XXXField.TYPE_STORED
from all the sugar fields (TextField, StringField, etc.); expert users
can always make a custom Indexable/Storable/Field/FieldType that both
stores & indexes...