Package org.basex.index.ft
Class FTIndex
java.lang.Object
org.basex.index.value.ValueIndex
org.basex.index.ft.FTIndex
- All Implemented Interfaces:
Index
This class provides access to a fuzzy full-text index structure
stored on disk. Each token has an entry in sizes, saving its length and a
pointer on ftdata, where to find the token and its ftdata.
The three database index files start with the prefix
DataText.DATAFTX and have the following format:
- File x contains an entry for each token length.
Structure:
[l, p] ....lis the length of a token [byte].pis the pointer of the first token with lengthl[int]. - File y contains the tokens and references.
Structure:
[t0, t1, ... tl, z, s]t0, t1, ... tl-1is the token [byte[l]]zis the pointer on the data entries of the token [long]sis the number of pre values, saved in data [int] - File z contains the
id/posreferences. The values are ordered, but not distinct:pre1/pos1, pre2/pos2, pre3/pos3, ...[Num]
- Author:
- BaseX Team 2005-21, BSD License, Christian Gruen
-
Field Summary
Fields inherited from class org.basex.index.value.ValueIndex
data, type -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(ValueCache values) Add entries to the index.voidclose()Closes the index.costs(IndexSearch search) Computes costs for performing the specified search.voiddelete(ValueCache values) Deletes entries from the index.booleandrop()Drops the index.entries(IndexEntries entries) Returns all entries that match the specified token.voidflush()Flushes the buffered data.byte[]info(MainOptions options) Returns information on the index structure.iter(IndexSearch search) Returns an iterator for the index results.intsize()Returns the number of index entries.
-
Constructor Details
-
FTIndex
Constructor, initializing the index structure.- Parameters:
data- data reference- Throws:
IOException- I/O Exception
-
-
Method Details
-
costs
Description copied from interface:IndexComputes costs for performing the specified search. An integer is returned:- A negative value indicates that index access is not possible.
- A value of zero indicates that no results will be returned.
- A small value indicates that index access is fast.
- Parameters:
search- index search definition- Returns:
- cost estimation
-
iter
Description copied from interface:IndexReturns an iterator for the index results.- Parameters:
search- index search definition- Returns:
- sorted pre values for the token
-
entries
Description copied from interface:IndexReturns all entries that match the specified token.- Parameters:
entries- index entries- Returns:
- entries
-
info
Description copied from interface:IndexReturns information on the index structure.- Parameters:
options- main options- Returns:
- info
-
drop
public boolean drop()Description copied from interface:IndexDrops the index. Also returns true if the index does not exist.- Returns:
- success flag
-
close
public void close()Description copied from interface:IndexCloses the index. -
size
public int size()Description copied from class:ValueIndexReturns the number of index entries.- Specified by:
sizein classValueIndex- Returns:
- number of index entries
-
add
Description copied from class:ValueIndexAdd entries to the index.- Specified by:
addin classValueIndex- Parameters:
values- value cache with [key, id-list] pairs
-
delete
Description copied from class:ValueIndexDeletes entries from the index.- Specified by:
deletein classValueIndex- Parameters:
values- value cache with [key, id-list] pairs
-
flush
public void flush()Description copied from class:ValueIndexFlushes the buffered data.- Specified by:
flushin classValueIndex
-