lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 7912] - Field.isIndexed() returns false for UnStored fields
Date Mon, 20 May 2002 17:28:15 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=7912>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=7912

Field.isIndexed() returns false for UnStored fields





------- Additional Comments From cutting@apache.org  2002-05-20 17:28 -------
Looks good to me.

A couple of minor improvements:

The line:
    return (String[]) v.toArray(new String[v.size()]);

Would be more efficient if you use a static for the prototype, e.g.:
  private static final STRING_ARRAY_PROTO = new String[0];
  ...
    return (String[]) v.toArray(STRING_ARRAY_PROTO);
This saves the allocation of an extra array.

Note: toArray is not in Java 1.1, so if we decide to keep Lucene 1.1 
compatible, then this will have to be re-written as a 'for' loop anyway...

And in SegmentsReader.getIndexedFieldNames, you don't need the intermediate 
Vector: you can create the array and fill it directly from the Hashtable:

     Enumeration it = h.keys();
     String[] result = new String[h.size()];
     for (int i = 0; i < h.size(); i++) { 
       result[i] = it.nextElement();
     }
     return result;

This saves the allocation of the Vector, and is less code too.

--
To unsubscribe, e-mail:   <mailto:lucene-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:lucene-dev-help@jakarta.apache.org>


Mime
View raw message