jcolibri.extensions.textual.lucene
Class LuceneIndex

java.lang.Object
  extended by jcolibri.extensions.textual.lucene.LuceneIndex

public class LuceneIndex
extends java.lang.Object

This class wraps the Lucene inverted terms index. This structure stores in which documents appears a word.
It also mantains a hash table that allows to retrieve a document form the index given its ID.

There are two ways to store the index:

Version:
2.0
Author:
Juan A. Recio-García

Constructor Summary
LuceneIndex(java.util.Collection<LuceneDocument> documents)
          Creates an index stored into memory.
LuceneIndex(java.io.File directory, java.util.Collection<LuceneDocument> documents)
          Creates a LuceneIndex stored in the File System.
 
Method Summary
 org.apache.lucene.store.Directory getDirectory()
           
 LuceneDocument getDocument(java.lang.String docId)
           
 int getNumberOfDocuments()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LuceneIndex

public LuceneIndex(java.io.File directory,
                   java.util.Collection<LuceneDocument> documents)
Creates a LuceneIndex stored in the File System.

Parameters:
directory - to store the index once generated
documents - to index

LuceneIndex

public LuceneIndex(java.util.Collection<LuceneDocument> documents)
Creates an index stored into memory.

Parameters:
documents - to index.
Method Detail

getDirectory

public org.apache.lucene.store.Directory getDirectory()
Returns:
the directory

getNumberOfDocuments

public int getNumberOfDocuments()

getDocument

public LuceneDocument getDocument(java.lang.String docId)

GAIA - Group for Artificial Intelligence Applications
http://gaia.fdi.ucm.es