Ard Schrijvers wrote:
Christoph Kiehl wrote:
We could use IndexReader.getFieldNames() at startup to check
if such a
field already exists which means we have an index in the new
format and
then use this information in MatchAllScorer to decide which
implementation to use.
This is not possible AFAICS, since if you do a startup with an old index, index 1
document again, do a restart, then we would see the index as "in the new
format", while all previous indexed documents still do not have this field.
There should never be an index where the old and the new format is mixed. Either
you have an index without the new field, to which you will never add a document
with the new field, or you have an index with the new field which means you can
rely on the fact that all documents are in the new format and index your new doc
with the new field.
If you have no index at all you start with a new index to which only documents
with the new field will be added. There should be a flag set at startup for
example in SearchIndex which indicates if an index is in the new or old format.
This flag should be used by NodeIndexer and MatchAllScorer somehow to decide
which strategy to use.
Hope I made my thoughts clear ;) not sure it's understandable.
Cheers,
Christoph