/*
*
* This code is used to test the content contained in the file Segment.fnm file
*. FNM contains all field names in document
* */
The generated index file. All field names for document are included in the FNM.
is to generate an index to open the displayed file.
Package segment;
Import java.io.IOException;
Import Org.apache.lucene.analysis.standard.StandardAnalyzer;
Import org.apache.lucene.document.Document;
Import Org.apache.lucene.document.Field;
Import Org.apache.lucene.index.IndexWriter;
public class Segment {
Private String Index_path = "E:\\lucene project \ \ Index file";
Document Doc1 = null;
Document doc2 = null;
Public Segment () {
Try
{ Doc1 = new Document ();
Field f1 = new Field ("Name1", "SMI Steve Ted Teddy Terry", Field.Store.YES, Field.Index.TOKENIZED);
Field F2 = new Field ("Name2", "What is You doing", Field.Store.YES, Field.Index.TOKENIZED);
Field F3 = new Field ("Name3", "How does You Do", Field.Store.YES, Field.Index.TOKENIZED);
Doc1.add (F1);
Doc1.add (F2);
Doc1.add (F3);
DOC2 = new Document ();
Field f4 = new Field ("Name4", "SMI Steve Ted Teddy Terry", Field.Store.YES, Field.Index.TOKENIZED);
Field f5 = new Field ("Name4", "What is You doing", Field.Store.YES, Field.Index.TOKENIZED);
Doc2.add (F4);
Doc2.add (F5);
IndexWriter writer = new IndexWriter (Index_path, New StandardAnalyzer (), true);
Writer.setusecompoundfile (FALSE);
Writer.adddocument (Doc1);
Writer.adddocument (DOC2);
Writer.close ();
}catch (IOException e) {
E.printstacktrace ();
}
}
public static void Main (string[] args) {
TODO auto-generated Method Stub
Segment se = new Segment ();
}
}
Content contained in the SEGMENT.FNM file generated using the Lucene Test index (detailed)