Menu

#9 GetIndexedFieldNames still broken

open
nobody
None
5
2013-01-10
2005-04-26
Anonymous
No

MultiReader.GetIndexedFieldNames(...) is still broken
in 1.4.3 build 002. It is returning a Hashtable of
DictionaryEntry objects (keys and values are both
DirectoryEntry object) rather than a Hashtable of
Strings (keys and values are both strings).

In general, (and you may consider this a second bug)
the Lucene documentation/specification for
IndexReader.GetFieldNames(...) and
IndexReader.GetIndexedFieldNames(...) should return "a
collection of Strings". By using Hashtable collections,
you are returning collections of DictionaryEntry
objects rather than Strings and it requires the caller
to know that. In order to comply with the java
documentation/specification, you should return a
collection of Strings by either:

1. using
System.Collections.Specialized.StringCollection instead
of Hashtable; or

2. if you want to use the Hashtable internally to your
method, it should return Hashtable.Keys.

Doing so would allow the caller to assume that the
ICollection being returned contains only Strings,
making the following program structure possible:

foreach(String s in reader.GetFieldNames() )
...

Thanks,
Eric Robinson
eric -at- attenex -dot- com

Discussion


Log in to post a comment.

MongoDB Logo MongoDB