lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Peter M Cipollone" <>
Subject question on design for ordering of field names written to FieldInfos object
Date Sat, 29 May 2004 22:43:45 GMT
(I accidentally sent this to the Users' list first)


I have a question about the following code from
org.apache.lucene.index.SegmentMerger.  I would like to know if the ordering
of the fields as they are stored to the FieldInfos object is critical to
some other purpose.

In the code below (from a week+/- ago CVS pull), the fields are stored in
the following order:
1. fields indexed=true, termVectors=true
2. fields indexed=true, termVectors=false
3. fields stored=true, indexed=false

The reason I ask is because I am working on some functionality that will
require the order of fields to be immutable across merges.  At present
FieldInfos are created in two ways, one from a Document as it is merged into
an index, and again when index segments are merged.  They use two different
ordering mechanisms.

Thanks for your help.

private final int mergeFields() throws IOException {
    fieldInfos = new FieldInfos();    // merge field names
    int docCount = 0;
    for (int i = 0; i < readers.size(); i++) {
      IndexReader reader = (IndexReader) readers.elementAt(i);
1.      fieldInfos.addIndexed(reader.getIndexedFieldNames(true), true);
2.      fieldInfos.addIndexed(reader.getIndexedFieldNames(false), false);
3.      fieldInfos.add(reader.getFieldNames(false), false);
    fieldInfos.write(directory, segment + ".fnm");

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message