Details
-
Bug
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
None
-
None
-
None
-
Operating System: Windows XP
Platform: PC
-
19058
Description
This class demonstrates the problem....
import org.apache.lucene.store.*;
import org.apache.lucene.document.*;
import org.apache.lucene.analysis.*;
import org.apache.lucene.analysis.standard.*;
import org.apache.lucene.index.*;
import org.apache.lucene.search.*;
import org.apache.lucene.queryParser.*;
import java.util.*;
public class FieldsTest
{
public static void main (String args[]) throws Exception
{
Analyzer analyzer=new StandardAnalyzer();
Directory dir= new RAMDirectory();
IndexWriter writer = new IndexWriter(dir, analyzer, true);
Document doc=new Document();
doc.add (new Field("field1", "value 1", true, true, true));
doc.add (new Field("field2", "value 2", true, true, true));
writer.addDocument(doc);
writer.close();
IndexReader reader=IndexReader.open(dir);
Collection fields=reader.getFieldNames();
//should contain only two fields but returns 3 (last fieldname
is blank)
Iterator i=fields.iterator();
while(i.hasNext())
}
}