Package org.teiid.internal.core.index
Class Index
- java.lang.Object
-
- org.teiid.internal.core.index.Index
-
- All Implemented Interfaces:
IIndex
public class Index extends Object implements IIndex
An Index is used to create an index on the disk, and to make queries. It uses a set of indexers and a mergeFactory. The index fills an inMemoryIndex up to it reaches a certain size, and then merges it with a main index on the disk.
The changes are only taken into account by the queries after a merge.
-
-
Field Summary
Fields Modifier and Type Field Description protected booleandoCachestatic intMAX_FOOTPRINTMaximum size of the index in memory.StringtoStringString representation of this index.
-
Constructor Summary
Constructors Constructor Description Index(org.teiid.metadata.VDBResource f)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes the index file if openprotected BlocksIndexInputgetBlocksIndexInput()BlocksIndexInputgetCachedInput()intgetNumDocuments()Returns the number of documents indexed.intgetNumWords()Returns the number of unique words indexed.StringgetResourceFileName()voidinitialize()Initialises the indexGenerator.IQueryResult[]query(String word)Returns the paths of the documents containing the given word.IEntryResult[]queryEntries(char[] prefix)Returns all entries for a given word.IEntryResult[]queryEntries(char[] prefix, boolean isCaseSensitive)Overloaded the method in Index to allow a user to specify if the query should be case sensitive.IEntryResult[]queryEntriesMatching(char[] prefix, boolean isCaseSensitive)Overloaded the method in Index to allow a user to specify if the query should be case sensitive.IQueryResult[]queryInDocumentNames(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.voidsetCachedInput(BlocksIndexInput theCachedInput)voidsetDoCache(boolean theDoCache)sets a boolean indicating the index file will be cached and should remain open and in-memoryStringtoString()
-
-
-
Field Detail
-
MAX_FOOTPRINT
public static final int MAX_FOOTPRINT
Maximum size of the index in memory.- See Also:
- Constant Field Values
-
doCache
protected boolean doCache
-
toString
public String toString
String representation of this index.
-
-
Constructor Detail
-
Index
public Index(org.teiid.metadata.VDBResource f) throws IOException- Throws:
IOException
-
-
Method Detail
-
getNumDocuments
public int getNumDocuments() throws IOExceptionDescription copied from interface:IIndexReturns the number of documents indexed.- Specified by:
getNumDocumentsin interfaceIIndex- Throws:
IOException- See Also:
IIndex.getNumDocuments()
-
getNumWords
public int getNumWords() throws IOExceptionDescription copied from interface:IIndexReturns the number of unique words indexed.- Specified by:
getNumWordsin interfaceIIndex- Throws:
IOException- See Also:
IIndex.getNumWords()
-
initialize
public void initialize() throws IOExceptionInitialises the indexGenerator.- Throws:
IOException
-
query
public IQueryResult[] query(String word) throws IOException
Description copied from interface:IIndexReturns the paths of the documents containing the given word.- Specified by:
queryin interfaceIIndex- Throws:
IOException- See Also:
IIndex.query(java.lang.String)
-
queryEntries
public IEntryResult[] queryEntries(char[] prefix) throws IOException
Description copied from interface:IIndexReturns all entries for a given word.- Specified by:
queryEntriesin interfaceIIndex- Throws:
IOException
-
queryInDocumentNames
public IQueryResult[] queryInDocumentNames(String word) throws IOException
Description copied from interface:IIndexReturns the paths of the documents whose names contain the given word.- Specified by:
queryInDocumentNamesin interfaceIIndex- Throws:
IOException- See Also:
IIndex.queryInDocumentNames(java.lang.String)
-
queryPrefix
public IQueryResult[] queryPrefix(char[] prefix) throws IOException
Description copied from interface:IIndexReturns the paths of the documents containing the given word prefix.- Specified by:
queryPrefixin interfaceIIndex- Throws:
IOException- See Also:
IIndex.queryPrefix(char[])
-
queryEntriesMatching
public IEntryResult[] queryEntriesMatching(char[] prefix, boolean isCaseSensitive) throws IOException
Overloaded the method in Index to allow a user to specify if the query should be case sensitive.- Throws:
IOException
-
queryEntries
public IEntryResult[] queryEntries(char[] prefix, boolean isCaseSensitive) throws IOException
Overloaded the method in Index to allow a user to specify if the query should be case sensitive.- Throws:
IOException
-
getBlocksIndexInput
protected BlocksIndexInput getBlocksIndexInput()
-
close
public void close()
Description copied from interface:IIndexCloses the index file if open
-
setDoCache
public void setDoCache(boolean theDoCache)
Description copied from interface:IIndexsets a boolean indicating the index file will be cached and should remain open and in-memory- Specified by:
setDoCachein interfaceIIndex
-
getCachedInput
public BlocksIndexInput getCachedInput()
-
setCachedInput
public void setCachedInput(BlocksIndexInput theCachedInput)
-
getResourceFileName
public String getResourceFileName()
-
-