Hi, I have a small API change that I've added in my patch for LUCENE-843. It just changes two add methods in FieldInfos to return the FieldInfo instance for the added field, instead of void.
One of the methods is private, so that should be fine. The other one is public, but, was added after 2.1 and so hasn't been released yet, so we can still change it before releasing 2.2 without breaking backwards compatibility. If there are no objections I will commit this soon. Diffs: Index: src/java/org/apache/lucene/index/FieldInfos.java =================================================================== --- src/java/org/apache/lucene/index/FieldInfos.java (revision 544145) +++ src/java/org/apache/lucene/index/FieldInfos.java (working copy) @@ -174,12 +174,12 @@ * @param omitNorms true if the norms for the indexed field should be omitted * @param storePayloads true if payloads should be stored for this field */ - public void add(String name, boolean isIndexed, boolean storeTermVector, - boolean storePositionWithTermVector, boolean storeOffsetWithTermVector, - boolean omitNorms, boolean storePayloads) { + public FieldInfo add(String name, boolean isIndexed, boolean storeTermVector, + boolean storePositionWithTermVector, boolean storeOffsetWithTermVector, + boolean omitNorms, boolean storePayloads) { FieldInfo fi = fieldInfo(name); if (fi == null) { - addInternal(name, isIndexed, storeTermVector, storePositionWithTermVector, storeOffsetWithTermVector, omitNorms, storePayloads); + return addInternal(name, isIndexed, storeTermVector, storePositionWithTermVector, storeOffsetWithTermVector, omitNorms, storePayloads); } else { if (fi.isIndexed != isIndexed) { fi.isIndexed = true; // once indexed, always index @@ -201,17 +201,18 @@ } } + return fi; } - - private void addInternal(String name, boolean isIndexed, - boolean storeTermVector, boolean storePositionWithTermVector, - boolean storeOffsetWithTermVector, boolean omitNorms, boolean storePayloads) { + private FieldInfo addInternal(String name, boolean isIndexed, + boolean storeTermVector, boolean storePositionWithTermVector, + boolean storeOffsetWithTermVector, boolean omitNorms, boolean storePayloads) { FieldInfo fi = new FieldInfo(name, isIndexed, byNumber.size(), storeTermVector, storePositionWithTermVector, storeOffsetWithTermVector, omitNorms, storePayloads); byNumber.add(fi); byName.put(name, fi); + return fi; } public int fieldNumber(String fieldName) { Mike --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]