com.metamatrix.core.index
Interface IIndex


public interface IIndex

An IIndex is the interface used to generate an index file, and to make queries on this index.


Method Summary
 void add(IDocument document, IIndexer indexer)
          Adds the given document to the index.
 void close()
          Closes the index file if open
 void dispose()
          closes the index file then deletes it.
 void empty()
          Empties the index.
 java.io.File getIndexFile()
          Returns the index file on the disk.
 int getNumDocuments()
          Returns the number of documents indexed.
 int getNumWords()
          Returns the number of unique words indexed.
 java.lang.String getPath(int documentNumber)
          Returns the path corresponding to a given document number
 boolean hasChanged()
          Ansers true if has some changes to save.
 IQueryResult[] query(java.lang.String word)
          Returns the paths of the documents containing the given word.
 IEntryResult[] queryEntries(char[] pattern)
          Returns all entries for a given word.
 IQueryResult[] queryInDocumentNames(java.lang.String word)
          Returns the paths of the documents whose names contain the given word.
 IQueryResult[] queryPrefix(char[] prefix)
          Returns the paths of the documents containing the given word prefix.
 void remove(java.lang.String documentName)
          Removes the corresponding document from the index.
 void save()
          Saves the index on the disk.
 void setDoCache(boolean doCache)
          sets a boolean indicating the index file will be cached and should remain open and in-memory
 

Method Detail

add

void add(IDocument document,
         IIndexer indexer)
         throws java.io.IOException
Adds the given document to the index.

Throws:
java.io.IOException

empty

void empty()
           throws java.io.IOException
Empties the index.

Throws:
java.io.IOException

getIndexFile

java.io.File getIndexFile()
Returns the index file on the disk.


getNumDocuments

int getNumDocuments()
                    throws java.io.IOException
Returns the number of documents indexed.

Throws:
java.io.IOException

getNumWords

int getNumWords()
                throws java.io.IOException
Returns the number of unique words indexed.

Throws:
java.io.IOException

getPath

java.lang.String getPath(int documentNumber)
                         throws java.io.IOException
Returns the path corresponding to a given document number

Throws:
java.io.IOException

hasChanged

boolean hasChanged()
Ansers true if has some changes to save.


query

IQueryResult[] query(java.lang.String word)
                     throws java.io.IOException
Returns the paths of the documents containing the given word.

Throws:
java.io.IOException

queryEntries

IEntryResult[] queryEntries(char[] pattern)
                            throws java.io.IOException
Returns all entries for a given word.

Throws:
java.io.IOException

queryInDocumentNames

IQueryResult[] queryInDocumentNames(java.lang.String word)
                                    throws java.io.IOException
Returns the paths of the documents whose names contain the given word.

Throws:
java.io.IOException

queryPrefix

IQueryResult[] queryPrefix(char[] prefix)
                           throws java.io.IOException
Returns the paths of the documents containing the given word prefix.

Throws:
java.io.IOException

remove

void remove(java.lang.String documentName)
            throws java.io.IOException
Removes the corresponding document from the index.

Throws:
java.io.IOException

save

void save()
          throws java.io.IOException
Saves the index on the disk.

Throws:
java.io.IOException

close

void close()
Closes the index file if open

Since:
5.0

dispose

void dispose()
closes the index file then deletes it.

Since:
5.0

setDoCache

void setDoCache(boolean doCache)
sets a boolean indicating the index file will be cached and should remain open and in-memory

Parameters:
doCache -
Since:
5.0


Copyright © 2009. All Rights Reserved.