Package org.teiid.internal.core.index
Class BlocksIndexInput
- java.lang.Object
-
- org.teiid.internal.core.index.IndexInput
-
- org.teiid.internal.core.index.BlocksIndexInput
-
public class BlocksIndexInput extends IndexInput
This input is used for reading indexes saved using a BlocksIndexOutput.
-
-
Field Summary
Fields Modifier and Type Field Description protected org.teiid.core.util.LRUCacheblockCachestatic intCACHE_SIZEprotected FileListBlockcurrentFileListBlockprotected intcurrentFileListBlockNumprotected IndexBlockcurrentIndexBlockprotected intcurrentIndexBlockNumprotected org.teiid.metadata.VDBResourceindexFileprotected IndexSummarysummary-
Fields inherited from class org.teiid.internal.core.index.IndexInput
currentWordEntry, filePosition, wordPosition
-
-
Constructor Summary
Constructors Constructor Description BlocksIndexInput(org.teiid.metadata.VDBResource inputFile)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclearCache()clears the cache of this indexInput, if it keeps track of the information already read.voidclose()Closes the IndexInput.IndexedFilegetCurrentFile()Returns the current file the indexInput is pointing to in the index.protected WordEntrygetEntry(char[] word)Returns the entry corresponding to the given word.protected FileListBlockgetFileListBlock(int blockNum)Returns the FileListBlock with the given number.protected IndexBlockgetIndexBlock(int blockNum)Returns the IndexBlock (containing words) with the given number.IndexedFilegetIndexedFile(int fileNum)Returns the indexedFile corresponding to the given document number in the index the input reads in, or null if such indexedFile does not exist.IndexedFilegetIndexedFile(IDocument document)Returns the indexedFile corresponding to the given document in the index the input reads in (e.g.protected int[]getMatchingFileNumbers(char[] word)Returns the list of numbers of files containing the given word.intgetNumFiles()Returns the number of files in the index.intgetNumWords()Returns the number of unique words in the index.ObjectgetSource()Returns the Object the input is reading from.protected voidinit()Initialises the blocksIndexInputvoidmoveToNextFile()Moves the pointer on the current file to the next file in the index.voidmoveToNextWordEntry()Moves the pointer on the current word to the next file in the index.voidopen()Open the Source where the input gets the information from.IQueryResult[]query(String word)IEntryResult[]queryEntriesMatching(char[] pattern, boolean isCaseSensitive)Overloaded the method in BlocksIndexInput to allow a user to specify if the query should be case sensitive.IEntryResult[]queryEntriesPrefixedBy(char[] prefix)Returns the list of the files containing the given word in the index.IEntryResult[]queryEntriesPrefixedBy(char[] prefix, boolean isCaseSensitive)Overloaded the method in BlocksIndexInput to allow a user to specify if the query should be case sensitive.IQueryResult[]queryFilesReferringToPrefix(char[] prefix)IQueryResult[]queryInDocumentNames(String word)Returns the list of the files whose name contain the given word in the index.protected voidsetFirstFile()Set the pointer on the current file to the first file of the index.protected voidsetFirstWord()Set the pointer on the current word to the first word of the index.-
Methods inherited from class org.teiid.internal.core.index.IndexInput
getCurrentWordEntry, getFilePosition, hasMoreFiles, hasMoreWords, isOpen, setOpen
-
-
-
-
Field Detail
-
CACHE_SIZE
public static final int CACHE_SIZE
- See Also:
- Constant Field Values
-
currentFileListBlock
protected FileListBlock currentFileListBlock
-
currentFileListBlockNum
protected int currentFileListBlockNum
-
currentIndexBlockNum
protected int currentIndexBlockNum
-
currentIndexBlock
protected IndexBlock currentIndexBlock
-
indexFile
protected org.teiid.metadata.VDBResource indexFile
-
blockCache
protected org.teiid.core.util.LRUCache blockCache
-
summary
protected IndexSummary summary
-
-
Method Detail
-
clearCache
public void clearCache()
Description copied from class:IndexInputclears the cache of this indexInput, if it keeps track of the information already read.- Specified by:
clearCachein classIndexInput- See Also:
IndexInput.clearCache()
-
close
public void close() throws IOExceptionDescription copied from class:IndexInputCloses the IndexInput. For example, if the input is on a RandomAccessFile, it calls the close() method of RandomAccessFile.- Specified by:
closein classIndexInput- Throws:
IOException- See Also:
IndexInput.close()
-
getCurrentFile
public IndexedFile getCurrentFile() throws IOException
Description copied from class:IndexInputReturns the current file the indexInput is pointing to in the index.- Specified by:
getCurrentFilein classIndexInput- Throws:
IOException- See Also:
IndexInput.getCurrentFile()
-
getEntry
protected WordEntry getEntry(char[] word) throws IOException
Returns the entry corresponding to the given word.- Throws:
IOException
-
getFileListBlock
protected FileListBlock getFileListBlock(int blockNum) throws IOException
Returns the FileListBlock with the given number.- Throws:
IOException
-
getIndexBlock
protected IndexBlock getIndexBlock(int blockNum) throws IOException
Returns the IndexBlock (containing words) with the given number.- Throws:
IOException
-
getIndexedFile
public IndexedFile getIndexedFile(int fileNum) throws IOException
Description copied from class:IndexInputReturns the indexedFile corresponding to the given document number in the index the input reads in, or null if such indexedFile does not exist.- Specified by:
getIndexedFilein classIndexInput- Throws:
IOException- See Also:
IndexInput.getIndexedFile(int)
-
getIndexedFile
public IndexedFile getIndexedFile(IDocument document) throws IOException
Description copied from class:IndexInputReturns the indexedFile corresponding to the given document in the index the input reads in (e.g. the indexedFile with the same path in this index), or null if such indexedFile does not exist.- Specified by:
getIndexedFilein classIndexInput- Throws:
IOException- See Also:
IndexInput.getIndexedFile(IDocument)
-
getMatchingFileNumbers
protected int[] getMatchingFileNumbers(char[] word) throws IOExceptionReturns the list of numbers of files containing the given word.- Throws:
IOException
-
getNumFiles
public int getNumFiles()
Description copied from class:IndexInputReturns the number of files in the index.- Specified by:
getNumFilesin classIndexInput- See Also:
IndexInput.getNumFiles()
-
getNumWords
public int getNumWords()
Description copied from class:IndexInputReturns the number of unique words in the index.- Specified by:
getNumWordsin classIndexInput- See Also:
IndexInput.getNumWords()
-
getSource
public Object getSource()
Description copied from class:IndexInputReturns the Object the input is reading from. It can be an IIndex, a File, ...- Specified by:
getSourcein classIndexInput- See Also:
IndexInput.getSource()
-
init
protected void init() throws IOExceptionInitialises the blocksIndexInput- Throws:
IOException
-
moveToNextFile
public void moveToNextFile() throws IOExceptionDescription copied from class:IndexInputMoves the pointer on the current file to the next file in the index.- Specified by:
moveToNextFilein classIndexInput- Throws:
IOException- See Also:
IndexInput.moveToNextFile()
-
moveToNextWordEntry
public void moveToNextWordEntry() throws IOExceptionDescription copied from class:IndexInputMoves the pointer on the current word to the next file in the index.- Specified by:
moveToNextWordEntryin classIndexInput- Throws:
IOException- See Also:
IndexInput.moveToNextWordEntry()
-
open
public void open() throws IOExceptionDescription copied from class:IndexInputOpen the Source where the input gets the information from.- Specified by:
openin classIndexInput- Throws:
IOException- See Also:
IndexInput.open()
-
query
public IQueryResult[] query(String word) throws IOException
- Throws:
IOException
-
queryEntriesMatching
public IEntryResult[] queryEntriesMatching(char[] pattern, boolean isCaseSensitive) throws IOException
Overloaded the method in BlocksIndexInput to allow a user to specify if the query should be case sensitive.- Parameters:
pattern-isCaseSensitive-- Returns:
- Throws:
IOException
-
queryEntriesPrefixedBy
public IEntryResult[] queryEntriesPrefixedBy(char[] prefix) throws IOException
Description copied from class:IndexInputReturns the list of the files containing the given word in the index.- Specified by:
queryEntriesPrefixedByin classIndexInput- Throws:
IOException
-
queryEntriesPrefixedBy
public IEntryResult[] queryEntriesPrefixedBy(char[] prefix, boolean isCaseSensitive) throws IOException
Overloaded the method in BlocksIndexInput to allow a user to specify if the query should be case sensitive.- Throws:
IOException
-
queryFilesReferringToPrefix
public IQueryResult[] queryFilesReferringToPrefix(char[] prefix) throws IOException
- Specified by:
queryFilesReferringToPrefixin classIndexInput- Throws:
IOException
-
queryInDocumentNames
public IQueryResult[] queryInDocumentNames(String word) throws IOException
Description copied from class:IndexInputReturns the list of the files whose name contain the given word in the index.- Specified by:
queryInDocumentNamesin classIndexInput- Throws:
IOException- See Also:
IndexInput.queryInDocumentNames(String)
-
setFirstFile
protected void setFirstFile() throws IOExceptionDescription copied from class:IndexInputSet the pointer on the current file to the first file of the index.- Specified by:
setFirstFilein classIndexInput- Throws:
IOException- See Also:
IndexInput.setFirstFile()
-
setFirstWord
protected void setFirstWord() throws IOExceptionDescription copied from class:IndexInputSet the pointer on the current word to the first word of the index.- Specified by:
setFirstWordin classIndexInput- Throws:
IOException- See Also:
IndexInput.setFirstWord()
-
-