com.languagecomputer.api
Interface IndexService

All Superinterfaces:
Service
All Known Implementing Classes:
IndexServiceWebClient

public interface IndexService
extends Service

Document indexing service. Indexes a Document into either a persistent or in-memory index.

The IndexService interface does not allow for retrieval. Rather this should handled through another service, such as the DocumentRetrievalService.

Since:
1.0
Author:
Kirk Roberts

Method Summary
 void finish()
          Indicates that the indexing process is finished or has reached some checkpoint stage.
 Document get(String docID)
          Loads the Document with the given docID from the index.
 void index(Document document)
          Indexes the given Document.
 void remove(String documentID)
          Removes the Document with the given docID from the index.
 void setPath(String path)
          Sets the location of the index.
 
Methods inherited from interface com.languagecomputer.api.Service
getName, setSession
 

Method Detail

setPath

void setPath(String path)
             throws IOException
Sets the location of the index. If no index exists at the location, one will be created upon a call to index(Document). Calls to remove(String) and get(String), however, should throw an IOException. This is an optional operation.

Parameters:
path - The path to the index.
Throws:
IOException - If there is an issue accessing any I/O component required by the IndexService. Implementors may or may not validate the path and throw an exception if it is inaccessible.

index

void index(Document document)
           throws IOException
Indexes the given Document. This should now be retrievable using #getDocument(String). If no index currently exists at the location given to setPath(String), a new index should be created.

Parameters:
document - The Document to index.
Throws:
IOException - If there is an issue accessing any I/O component required by the IndexService.

finish

void finish()
            throws IOException
Indicates that the indexing process is finished or has reached some checkpoint stage. This method should block until all index writing is complete and the index becomes usable. Any optimization or index-wide analysis should be done within this method as well. Whether more documents may be added after finish is called is left up to the implementation.

Throws:
IOException - If there is an issue accessing any I/O component required by the IndexService.

remove

void remove(String documentID)
            throws IOException
Removes the Document with the given docID from the index.

Parameters:
docID - Unique identifier for the Document.
Throws:
IOException - If there is an issue accessing any I/O component required by the IndexService.

get

Document get(String docID)
             throws IOException
Loads the Document with the given docID from the index.

Parameters:
docID - Unique identifier for the Document.
Returns:
The Document with the given docID, or null if there is no such document in the index or if this operation is not supported.
Throws:
IOException - If there is an issue accessing any I/O component required by the IndexService.


Copyright © 2009. All Rights Reserved.