org.eaglei.search.provider.lucene
Class LuceneSearchProviderIndexer

java.lang.Object
  extended by org.eaglei.search.provider.lucene.LuceneSearchIndexSchema
      extended by org.eaglei.search.provider.lucene.LuceneSearchProviderIndexer

public final class LuceneSearchProviderIndexer
extends LuceneSearchIndexSchema

Creates a Lucene index for eagle-i RDF resource data according to the schema defined in LuceneSearchIndexSchema.

Author:
frost

Field Summary
 
Fields inherited from class org.eaglei.search.provider.lucene.LuceneSearchIndexSchema
HIGH_BOOST, INDEX_OBJECT_PROP_LABELS, INFERRED_TYPE, INSTITUTION_LABEL, INSTITUTION_URI, LOW_BOOST, MEDIUM_BOOST, OBJECT_URI_POSTFIX, PREF_TEXT, RELATED, RESOURCE_FLAG, STANDARD_BOOST, TEXT, URI
 
Constructor Summary
LuceneSearchProviderIndexer(org.eaglei.model.EIOntModel eagleiOntModel, org.apache.lucene.analysis.Analyzer analyzer, org.apache.lucene.store.Directory directory)
          Creates the LuceneSearchProviderIndexer
 
Method Summary
 void addIndirectProperties(org.eaglei.model.EIURI uri)
          Updates the document with the specified URI to add object property labels.
 void commit()
          Commits any pending changes the changes
 org.apache.lucene.index.IndexWriter getIndexWriter()
          Retrieves the IndexWriter
 java.util.List<org.eaglei.model.EIURI> getRelatedDocuments(org.eaglei.model.EIURI uri)
          Gets the EIURIs of all documents that reference the specified document via an object property.
 void indexSearchResult(org.eaglei.search.provider.SearchResult result, boolean materializeTypes)
          Indexes the specified SearchResult.
protected static boolean isDeletedSearchResult(org.eaglei.search.provider.SearchResult result)
          Checks if this SearchResult represents a deleted resource.
protected static java.lang.String stripObjectURIPostfix(java.lang.String fieldWithPostfix)
          Removes the _uri postfix from the document field name.
 
Methods inherited from class org.eaglei.search.provider.lucene.LuceneSearchIndexSchema
isLabProperty, isPropertyField
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LuceneSearchProviderIndexer

public LuceneSearchProviderIndexer(org.eaglei.model.EIOntModel eagleiOntModel,
                                   org.apache.lucene.analysis.Analyzer analyzer,
                                   org.apache.lucene.store.Directory directory)
                            throws java.io.IOException
Creates the LuceneSearchProviderIndexer

Parameters:
eagleiOntModel - Referenced to the eagle-i ontology
analyzer - The Lucene analyzer that is used for indexing and searching.
directory - The directory that holds the index.
Throws:
java.io.IOException - Thrown if an error is encountered.
Method Detail

getIndexWriter

public org.apache.lucene.index.IndexWriter getIndexWriter()
Retrieves the IndexWriter

Returns:

commit

public void commit()
            throws java.io.IOException
Commits any pending changes the changes

Throws:
java.io.IOException

getRelatedDocuments

public java.util.List<org.eaglei.model.EIURI> getRelatedDocuments(org.eaglei.model.EIURI uri)
                                                           throws java.io.IOException
Gets the EIURIs of all documents that reference the specified document via an object property.

Parameters:
uri - URI of property whose referencing documents are being retrieved.
Returns:
List of URIs of referencing documents.
Throws:
java.io.IOException - Thrown if an error is encountered executing the query

stripObjectURIPostfix

protected static java.lang.String stripObjectURIPostfix(java.lang.String fieldWithPostfix)
Removes the _uri postfix from the document field name.

Parameters:
fieldWithPostfix - Field with the _uri postfix
Returns:
Field name without the _uri postfix

addIndirectProperties

public void addIndirectProperties(org.eaglei.model.EIURI uri)
                           throws java.io.IOException
Updates the document with the specified URI to add object property labels.

Parameters:
uri - URI of document to update with fields for the labels of resources connected via object properties.
Throws:
java.io.IOException - Thrown if an error is encountered.

isDeletedSearchResult

protected static boolean isDeletedSearchResult(org.eaglei.search.provider.SearchResult result)
Checks if this SearchResult represents a deleted resource. The /harvest API returns a special resource representation for resources that have been deleted since the specified timestamp.

Returns:
True if it represents a deleted resource.

indexSearchResult

public void indexSearchResult(org.eaglei.search.provider.SearchResult result,
                              boolean materializeTypes)
                       throws java.io.IOException
Indexes the specified SearchResult.

Parameters:
result - SearchResult
materializeTypes - True if the types should be materialized.
Throws:
java.io.IOException - Thrown if an error is encountered indexing the result


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