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 19058] New: - Reader getFieldNames returns an extra blank field name
Date Wed, 16 Apr 2003 09:23:37 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=19058>.
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=19058

Reader getFieldNames returns an extra blank field name

           Summary: Reader getFieldNames returns an extra blank field name
           Product: Lucene
           Version: CVS Nightly - Specify date in submission
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: Minor
          Priority: Other
         Component: Store
        AssignedTo: lucene-dev@jakarta.apache.org
        ReportedBy: markharwood@totalise.co.uk


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())
		{
			System.out.println("fieldname=["+i.next()+"]");
		}


	}
}

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


Mime
View raw message