org.eaglei.lexical.lucene
Class LuceneEntityExtractionIndexer

java.lang.Object
  extended by org.eaglei.lexical.lucene.LuceneEntityExtractionIndexer
Direct Known Subclasses:
EIModelLuceneIndexer

public abstract class LuceneEntityExtractionIndexer
extends java.lang.Object

Wrapper class for a Lucene index that is used for entity extraction and auto-suggestion. The following index schema is used:

Author:
rfrost

Field Summary
static java.lang.String LABEL
           
static java.lang.String PREF_LABEL
           
static java.lang.String TYPE
           
static java.lang.String URI
           
 
Constructor Summary
LuceneEntityExtractionIndexer(org.apache.lucene.analysis.Analyzer analyzer, org.apache.lucene.store.Directory directory)
          Creates a new LuceneIndexer using the same analyzer for index creation and query execution.
 
Method Summary
protected abstract  void addDocuments(org.apache.lucene.index.IndexWriter iwriter)
          Adds the documents to the IndexWriter.
 org.apache.lucene.store.Directory getDirectory()
           
 org.apache.lucene.analysis.Analyzer getIndexAnalyzer()
           
 void index()
          Populates the Lucene index.
protected  void updateDocument(java.lang.String uri, java.lang.String prefLabel, java.util.List<java.lang.String> labels, java.util.List<java.lang.String> typeURIs, org.apache.lucene.index.IndexWriter iwriter)
          Adds or updates the document for the specified URI.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

URI

public static final java.lang.String URI
See Also:
Constant Field Values

LABEL

public static final java.lang.String LABEL
See Also:
Constant Field Values

PREF_LABEL

public static final java.lang.String PREF_LABEL
See Also:
Constant Field Values

TYPE

public static final java.lang.String TYPE
See Also:
Constant Field Values
Constructor Detail

LuceneEntityExtractionIndexer

public LuceneEntityExtractionIndexer(org.apache.lucene.analysis.Analyzer analyzer,
                                     org.apache.lucene.store.Directory directory)
Creates a new LuceneIndexer using the same analyzer for index creation and query execution.

Method Detail

getIndexAnalyzer

public org.apache.lucene.analysis.Analyzer getIndexAnalyzer()

getDirectory

public org.apache.lucene.store.Directory getDirectory()

index

public void index()
           throws java.io.IOException
Populates the Lucene index.

Throws:
java.io.IOException

addDocuments

protected abstract void addDocuments(org.apache.lucene.index.IndexWriter iwriter)
                              throws java.io.IOException
Adds the documents to the IndexWriter.

Parameters:
iwriter -
Throws:
java.io.IOException

updateDocument

protected void updateDocument(java.lang.String uri,
                              java.lang.String prefLabel,
                              java.util.List<java.lang.String> labels,
                              java.util.List<java.lang.String> typeURIs,
                              org.apache.lucene.index.IndexWriter iwriter)
                       throws java.io.IOException
Adds or updates the document for the specified URI.

Parameters:
uri - URI of the resource
prefLabel - The preferred label
labels - All labels to index
typeURIs - All type URIs
iwriter - Index writer
Throws:
java.io.IOException - Thrown if an error occurs


Copyright © 2009-2011 Eagle-I. All Rights Reserved.