Closed asfimport closed 17 years ago
Otis Gospodnetic (migrated from JIRA)
This method exists in the nightly build. This is an excerpt from the CHANGES.txt:
Please reopen if this doesn't work for you.
Andrzej Bialecki (migrated from JIRA)
Sorry, I missed that in my copy... However, the implementation uses Collections framework. Below is the code rewritten using JDK1.1.x Vector:
public final Field[] getFields(String name) { Vector tempFieldList = new Vector(); for (DocumentFieldList list = fieldList; list != null; list = list.next) { if (list.field.name().equals(name)) { tempFieldList.add(list.field); } } int fieldCount = tempFieldList.size(); if (fieldCount == 0) return null; else { Field[] fields = new Field[fieldCount]; tempFieldList.copyInto(fields); return fields; } }
Otis Gospodnetic (migrated from JIRA)
Thank you for the code, but like I mentioned in the direct email to you a few days ago, I believe Lucene developers reached the consensus that any new code that gets written does not need to support JDK 1.1.x. On the whole I think we agreed that we don't need to make sure to support JDK 1.1.x.
Lucene Developers - please reopen, or better yet, modify the code, if this is not true.
Andrzej Bialecki (migrated from JIRA)
Ok, I can accept that - although it's a pity, since most mobile platforms support only 1.1. However, please bear with me - the version in CVS uses inefficient for() loop, whereas the code above uses copyInto(), which in turn uses System.arraycopy(), implemented as native, so it appears to me there is still some benefit in making this change...
Best regards Andrzej
Currently there is no quick way to retrieve multiple fields with the same name, other than retrieving Enumeration of all fields. A useful shortcut would be to provide a method on Document:
public Field[] getFields(String name)
Migrated from LUCENE-77 by Andrzej Bialecki, resolved May 27 2006 Environment: