public class BlocksIndexInput extends IndexInput
Modifier and Type | Field and Description |
---|---|
protected LRUCache |
blockCache |
static int |
CACHE_SIZE |
protected FileListBlock |
currentFileListBlock |
protected int |
currentFileListBlockNum |
protected IndexBlock |
currentIndexBlock |
protected int |
currentIndexBlockNum |
protected VDBResource |
indexFile |
protected IndexSummary |
summary |
currentWordEntry, filePosition, wordPosition
Constructor and Description |
---|
BlocksIndexInput(VDBResource inputFile) |
Modifier and Type | Method and Description |
---|---|
void |
clearCache()
clears the cache of this indexInput, if it keeps track of the information already read.
|
void |
close()
Closes the IndexInput.
|
IndexedFile |
getCurrentFile()
Returns the current file the indexInput is pointing to in the index.
|
protected WordEntry |
getEntry(char[] word)
Returns the entry corresponding to the given word.
|
protected FileListBlock |
getFileListBlock(int blockNum)
Returns the FileListBlock with the given number.
|
protected IndexBlock |
getIndexBlock(int blockNum)
Returns the IndexBlock (containing words) with the given number.
|
IndexedFile |
getIndexedFile(IDocument document)
Returns the indexedFile corresponding to the given document in the index the input
reads in (e.g.
|
IndexedFile |
getIndexedFile(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.
|
protected int[] |
getMatchingFileNumbers(char[] word)
Returns the list of numbers of files containing the given word.
|
int |
getNumFiles()
Returns the number of files in the index.
|
int |
getNumWords()
Returns the number of unique words in the index.
|
Object |
getSource()
Returns the Object the input is reading from.
|
protected void |
init()
Initialises the blocksIndexInput
|
void |
moveToNextFile()
Moves the pointer on the current file to the next file in the index.
|
void |
moveToNextWordEntry()
Moves the pointer on the current word to the next file in the index.
|
void |
open()
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 void |
setFirstFile()
Set the pointer on the current file to the first file of the index.
|
protected void |
setFirstWord()
Set the pointer on the current word to the first word of the index.
|
getCurrentWordEntry, getFilePosition, hasMoreFiles, hasMoreWords, isOpen, setOpen
public static final int CACHE_SIZE
protected FileListBlock currentFileListBlock
protected int currentFileListBlockNum
protected int currentIndexBlockNum
protected IndexBlock currentIndexBlock
protected VDBResource indexFile
protected LRUCache blockCache
protected IndexSummary summary
public BlocksIndexInput(VDBResource inputFile)
public void clearCache()
IndexInput
clearCache
in class IndexInput
IndexInput.clearCache()
public void close() throws IOException
IndexInput
close
in class IndexInput
IOException
IndexInput.close()
public IndexedFile getCurrentFile() throws IOException
IndexInput
getCurrentFile
in class IndexInput
IOException
IndexInput.getCurrentFile()
protected WordEntry getEntry(char[] word) throws IOException
IOException
protected FileListBlock getFileListBlock(int blockNum) throws IOException
IOException
protected IndexBlock getIndexBlock(int blockNum) throws IOException
IOException
public IndexedFile getIndexedFile(int fileNum) throws IOException
IndexInput
getIndexedFile
in class IndexInput
IOException
IndexInput.getIndexedFile(int)
public IndexedFile getIndexedFile(IDocument document) throws IOException
IndexInput
getIndexedFile
in class IndexInput
IOException
IndexInput.getIndexedFile(IDocument)
protected int[] getMatchingFileNumbers(char[] word) throws IOException
IOException
public int getNumFiles()
IndexInput
getNumFiles
in class IndexInput
IndexInput.getNumFiles()
public int getNumWords()
IndexInput
getNumWords
in class IndexInput
IndexInput.getNumWords()
public Object getSource()
IndexInput
getSource
in class IndexInput
IndexInput.getSource()
protected void init() throws IOException
IOException
public void moveToNextFile() throws IOException
IndexInput
moveToNextFile
in class IndexInput
IOException
IndexInput.moveToNextFile()
public void moveToNextWordEntry() throws IOException
IndexInput
moveToNextWordEntry
in class IndexInput
IOException
IndexInput.moveToNextWordEntry()
public void open() throws IOException
IndexInput
open
in class IndexInput
IOException
IndexInput.open()
public IQueryResult[] query(String word) throws IOException
IOException
public IEntryResult[] queryEntriesMatching(char[] pattern, boolean isCaseSensitive) throws IOException
pattern
- isCaseSensitive
- IOException
public IEntryResult[] queryEntriesPrefixedBy(char[] prefix) throws IOException
IndexInput
queryEntriesPrefixedBy
in class IndexInput
IOException
public IEntryResult[] queryEntriesPrefixedBy(char[] prefix, boolean isCaseSensitive) throws IOException
IOException
public IQueryResult[] queryFilesReferringToPrefix(char[] prefix) throws IOException
queryFilesReferringToPrefix
in class IndexInput
IOException
public IQueryResult[] queryInDocumentNames(String word) throws IOException
IndexInput
queryInDocumentNames
in class IndexInput
IOException
IndexInput.queryInDocumentNames(String)
protected void setFirstFile() throws IOException
IndexInput
setFirstFile
in class IndexInput
IOException
IndexInput.setFirstFile()
protected void setFirstWord() throws IOException
IndexInput
setFirstWord
in class IndexInput
IOException
IndexInput.setFirstWord()
Copyright © 2020. All rights reserved.