Loading one field in lucene index
You may need to address why you need to load of your Fields into memory in the first place?
Have you tried doing a search using a TermQuery and a Term that simply contains the field you want to load? e.g. new Term("ID").
You then wont need to load all values into memory to iterate over them. Instead, use a FieldSelector to ensure only a single field is loaded when you load each search result.
Otherwise, use Lucene's FieldCache to get the values for all your ID fields.
精彩评论