concept file in category lucene

appears as: files, files, file, file, The file
Lucene in Action, Second Edition

This is an excerpt from Manning's book Lucene in Action, Second Edition.

  • A path to a directory that contains the files we want to index
  • If you look at the index directory created by our Indexer, you’ll see a number of files whose names may seem random at first. These are index files, and they look similar to those shown here:

    -rw-rw-rw- 1 mike users 12327579 Feb 29 05:29 _2.fdt
    -rw-rw-rw- 1 mike users     6400 Feb 29 05:29 _2.fdx
    -rw-rw-rw- 1 mike users       33 Feb 29 05:29 _2.fnm
    -rw-rw-rw- 1 mike users  1036074 Feb 29 05:29 _2.frq
    -rw-rw-rw- 1 mike users     2404 Feb 29 05:29 _2.nrm
    -rw-rw-rw- 1 mike users  2128366 Feb 29 05:29 _2.prx
    -rw-rw-rw- 1 mike users    14055 Feb 29 05:29 _2.tii
    -rw-rw-rw- 1 mike users  1034353 Feb 29 05:29 _2.tis
    -rw-rw-rw- 1 mike users     5829 Feb 29 05:29 _2.tvd
    -rw-rw-rw- 1 mike users 10227627 Feb 29 05:29 _2.tvf
    -rw-rw-rw- 1 mike users    12804 Feb 29 05:29 _2.tvx
    -rw-rw-rw- 1 mike users       20 Feb 29 05:29 segments.gen
    -rw-rw-rw- 1 mike users       53 Feb 29 05:29 segments_3

    Notice that some files share the same prefix. In this example index, most of the files start with the prefix _2, followed by various extensions. This leads us to the notion of segments.

    Lucene uses a well-known index structure called an inverted index. Quite simply, and probably unsurprisingly, an inverted index is an inside-out arrangement of documents in which terms take center stage. Each term refers to the documents that contain it. Let’s dissect our sample book data index to get a deeper glimpse at the files in an index Directory.

    Regardless of whether you’re working with a RAMDirectory, an FSDirectory, or any other Directory implementation, the internal structure is a group of files. In a RAMDirectory, the files are virtual and live entirely within RAM. FSDirectory literally represents an index as a file system directory, as described earlier in this appendix.

    The compound file mode adds an additional twist regarding the files in a Directory. When an IndexWriter is set for compound file mode, the “files” are written to a single .cfs file, which alleviates the common issue of running out of file handles. See section B.2.2 for more information on the compound file mode.