Class LuceneBuilder<C>
java.lang.Object
es.uam.eps.ir.relison.content.index.AbstractIndexBuilder<C>
es.uam.eps.ir.relison.content.index.lucene.LuceneBuilder<C>
- Type Parameters:
C- Type of the contents.
- All Implemented Interfaces:
IndexBuilder<C>
- Direct Known Subclasses:
LuceneForwardIndexBuilder,LucenePositionalIndexBuilder
public class LuceneBuilder<C> extends AbstractIndexBuilder<C>
Lucene implementation of an Index Builder
-
Field Summary
Fields Modifier and Type Field Description private org.apache.lucene.index.IndexWriterbuilderIndex writer.private java.lang.StringindexFolderFolder in which to store the indexprivate it.unimi.dsi.fastutil.ints.Int2ObjectMap<C>mapMap storing the relation between docids and contents.protected static org.apache.lucene.document.FieldTypetypeCustom type for storing each content. -
Constructor Summary
Constructors Constructor Description LuceneBuilder()Constructor. -
Method Summary
Modifier and Type Method Description voidclose(java.lang.String indexPath)Closes the builder.Index<C>getCoreIndex()Obtains the generated index.intindexText(java.lang.String text, C content)Writes the contents of a user in the index.voidinit(java.lang.String indexPath)Initializes the builder.Methods inherited from class es.uam.eps.ir.relison.content.index.AbstractIndexBuilder
clear, saveContentMap
-
Field Details
-
type
protected static org.apache.lucene.document.FieldType typeCustom type for storing each content. -
builder
private org.apache.lucene.index.IndexWriter builderIndex writer. -
indexFolder
private java.lang.String indexFolderFolder in which to store the index -
map
Map storing the relation between docids and contents.
-
-
Constructor Details
-
LuceneBuilder
public LuceneBuilder()Constructor.
-
-
Method Details
-
init
public void init(java.lang.String indexPath) throws java.io.IOExceptionDescription copied from interface:IndexBuilderInitializes the builder.- Parameters:
indexPath- path containing the index.- Throws:
java.io.IOException- if something fails while initializing the index.
-
close
public void close(java.lang.String indexPath) throws java.io.IOExceptionDescription copied from interface:IndexBuilderCloses the builder.- Parameters:
indexPath- path containing the index.- Throws:
java.io.IOException- if something fails while closing the index.
-
indexText
Description copied from interface:IndexBuilderWrites the contents of a user in the index.- Parameters:
text- the published content.content- the user.- Returns:
- the identifier of the new document.
- Throws:
java.io.IOException- if something fails while writing the contents.
-
getCoreIndex
Description copied from class:AbstractIndexBuilderObtains the generated index.- Specified by:
getCoreIndexin classAbstractIndexBuilder<C>- Returns:
- the generated index.
- Throws:
java.io.IOException- if something fails while creating such index.
-