Content contained in the SEGMENT.FNM file generated using the Lucene Test index (detailed)

Source: Internet
Author: User

/*
*
* 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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.