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 boolean
doCache
static int
MAX_FOOTPRINT
Maximum size of the index in memory.String
toString
String representation of this index.
-
Constructor Summary
Constructors Constructor Description Index(VDBResource f)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Closes the index file if openprotected BlocksIndexInput
getBlocksIndexInput()
BlocksIndexInput
getCachedInput()
int
getNumDocuments()
Returns the number of documents indexed.int
getNumWords()
Returns the number of unique words indexed.String
getResourceFileName()
void
initialize()
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.void
setCachedInput(BlocksIndexInput theCachedInput)
void
setDoCache(boolean theDoCache)
sets a boolean indicating the index file will be cached and should remain open and in-memoryString
toString()
-
-
-
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(VDBResource f) throws IOException
- Throws:
IOException
-
-
Method Detail
-
getNumDocuments
public int getNumDocuments() throws IOException
Description copied from interface:IIndex
Returns the number of documents indexed.- Specified by:
getNumDocuments
in interfaceIIndex
- Throws:
IOException
- See Also:
IIndex.getNumDocuments()
-
getNumWords
public int getNumWords() throws IOException
Description copied from interface:IIndex
Returns the number of unique words indexed.- Specified by:
getNumWords
in interfaceIIndex
- Throws:
IOException
- See Also:
IIndex.getNumWords()
-
initialize
public void initialize() throws IOException
Initialises the indexGenerator.- Throws:
IOException
-
query
public IQueryResult[] query(String word) throws IOException
Description copied from interface:IIndex
Returns the paths of the documents containing the given word.- Specified by:
query
in interfaceIIndex
- Throws:
IOException
- See Also:
IIndex.query(java.lang.String)
-
queryEntries
public IEntryResult[] queryEntries(char[] prefix) throws IOException
Description copied from interface:IIndex
Returns all entries for a given word.- Specified by:
queryEntries
in interfaceIIndex
- Throws:
IOException
-
queryInDocumentNames
public IQueryResult[] queryInDocumentNames(String word) throws IOException
Description copied from interface:IIndex
Returns the paths of the documents whose names contain the given word.- Specified by:
queryInDocumentNames
in interfaceIIndex
- Throws:
IOException
- See Also:
IIndex.queryInDocumentNames(java.lang.String)
-
queryPrefix
public IQueryResult[] queryPrefix(char[] prefix) throws IOException
Description copied from interface:IIndex
Returns the paths of the documents containing the given word prefix.- Specified by:
queryPrefix
in 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:IIndex
Closes the index file if open
-
setDoCache
public void setDoCache(boolean theDoCache)
Description copied from interface:IIndex
sets a boolean indicating the index file will be cached and should remain open and in-memory- Specified by:
setDoCache
in interfaceIIndex
-
getCachedInput
public BlocksIndexInput getCachedInput()
-
setCachedInput
public void setCachedInput(BlocksIndexInput theCachedInput)
-
getResourceFileName
public String getResourceFileName()
-
-