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.IndexWriter
builder
Index writer.private java.lang.String
indexFolder
Folder in which to store the indexprivate it.unimi.dsi.fastutil.ints.Int2ObjectMap<C>
map
Map storing the relation between docids and contents.protected static org.apache.lucene.document.FieldType
type
Custom type for storing each content. -
Constructor Summary
Constructors Constructor Description LuceneBuilder()
Constructor. -
Method Summary
Modifier and Type Method Description void
close(java.lang.String indexPath)
Closes the builder.Index<C>
getCoreIndex()
Obtains the generated index.int
indexText(java.lang.String text, C content)
Writes the contents of a user in the index.void
init(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:IndexBuilder
Initializes 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:IndexBuilder
Closes the builder.- Parameters:
indexPath
- path containing the index.- Throws:
java.io.IOException
- if something fails while closing the index.
-
indexText
Description copied from interface:IndexBuilder
Writes 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:AbstractIndexBuilder
Obtains the generated index.- Specified by:
getCoreIndex
in classAbstractIndexBuilder<C>
- Returns:
- the generated index.
- Throws:
java.io.IOException
- if something fails while creating such index.
-