|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
O
- The object that will be indexed in the databasepublic interface Index<O extends OB>
This the main contract for OBSearch indexes. The normal lifecycle of an index is: 1) Insert many records 2) Perform a freeze A freeze is an operation that calculates different information on the data. The idea is to "learn" how the sample data is distributed to improve performance. You cannot perform searches on an unfrozen index. Note that freezing the index does not mean you cannot insert new data. You can! 3) Insert/Delete new records/ and search. There are indexes that wrap other indexes to provide extended functionality. Please consult the documentation for each index. The index assumes that for any two objects a, b: if a.equals(b) then for their corresponding byte arrays ba,bb ba.equals(bb) must also hold.
Field Summary | |
---|---|
static int |
ID_SIZE
Size in bytes of the object IDs used in OBSearch. |
Method Summary | |
---|---|
void |
close()
Closes the database. |
long |
databaseSize()
Returns the database size. |
String |
debug(O object)
Routine that helps to debug objects. |
OperationStatus |
delete(O object)
Deletes the given object from the database. |
OperationStatus |
exists(O object)
Returns true if the given object exists in the database. |
void |
freeze()
Freezes the index. |
long |
getBox(O object)
Returns the box where the given object is stored. |
O |
getObject(long i)
This method returns the object with internal id "i". |
Statistics |
getStats()
|
Class<O> |
getType()
Return the type that is stored in the index. |
void |
init(OBStoreFactory fact)
This method *must* be called after de-serializing the database object and after instantiating the index. |
OperationStatus |
insert(O object)
Inserts the given object into the index. |
OperationStatus |
insert(O object,
long id)
Inserts the given object into the index. |
OperationStatus |
insertBulk(O object)
Inserts the given object into the index. |
OperationStatus |
insertBulk(O object,
long id)
Inserts the given object into the index. |
boolean |
isFrozen()
Returns true if the index is frozen. |
void |
loadObject(long i,
O object)
Load the data of object # i into the given object |
void |
resetStats()
Resets all the stats counters. |
void |
setPreFreezeCheck(boolean preFreezeCheck)
If the index should check for existent objects before freeze. |
long |
totalBoxes()
Returns the total number of boxes this index can hold. |
Field Detail |
---|
static final int ID_SIZE
Method Detail |
---|
OperationStatus insert(O object) throws OBStorageException, OBException, IllegalAccessException, InstantiationException
object
- The object to be added.
Status.OK
if the object was inserted.
Status.EXISTS
if the object existed in the DB.
The method getId() of OperationStatus
will return
the id used by the object.
OBStorageException
- If something goes wrong with the DB
OBException
- User generated exception
IllegalAccessException
- If there is a problem when instantiating objects O
InstantiationException
- If there is a problem when instantiating objects OClass<O> getType()
void loadObject(long i, O object) throws OBException
i
- object
-
OBException
OperationStatus insertBulk(O object) throws OBStorageException, OBException, IllegalAccessException, InstantiationException
object
- The object to be added.
Status.OK
OBStorageException
- If something goes wrong with the DB
OBException
- User generated exception
IllegalAccessException
- If there is a problem when instantiating objects O
InstantiationException
- If there is a problem when instantiating objects OOperationStatus insert(O object, long id) throws OBStorageException, OBException, IllegalAccessException, InstantiationException
object
- The object to be added.id
- The id that will be used for the object.
Status.OK
or
Status.EXISTS
then the result will hold
the id of the inserted object and the operation is successful.
Otherwise an exception will be thrown.
OBStorageException
- If something goes wrong with the DB
OBException
- User generated exception
IllegalAccessException
- If there is a problem when instantiating objects O
InstantiationException
- If there is a problem when instantiating objects OOperationStatus insertBulk(O object, long id) throws OBStorageException, OBException, IllegalAccessException, InstantiationException
object
- The object to be added.id
- The id that will be used for the object.
Status.OK
OBStorageException
- If something goes wrong with the DB
OBException
- User generated exception
IllegalAccessException
- If there is a problem when instantiating objects O
InstantiationException
- If there is a problem when instantiating objects Oboolean isFrozen()
OperationStatus exists(O object) throws OBStorageException, OBException, IllegalAccessException, InstantiationException
object
- The object that will be searched.
Status.EXISTS
and the object's id if
the object exists in the database, otherwise
Status.NOT_EXISTS
is returned.
OBStorageException
- If something goes wrong with the DB
OBException
- User generated exception
IllegalAccessException
- If there is a problem when instantiating objects O
InstantiationException
- If there is a problem when instantiating objects Ovoid freeze() throws IOException, AlreadyFrozenException, IllegalIdException, IllegalAccessException, InstantiationException, OBStorageException, OutOfRangeException, OBException, PivotsUnavailableException
IOException
- if the index serialization process fails
AlreadyFrozenException
- If the index was already frozen and the user attempted to
freeze it again
OBStorageException
- If something goes wrong with the DB
OBException
- User generated exception
IllegalAccessException
- If there is a problem when instantiating objects O
InstantiationException
- If there is a problem when instantiating objects O
OutOfRangeException
- If the distance of any object to any other object exceeds
the range defined by the user.
IllegalIdException
- This exception is left as a Debug flag. If you receive
this exception please report the problem to:
http://code.google.com/p/obsearch/issues/list
PivotsUnavailableException
OperationStatus delete(O object) throws OBStorageException, OBException, IllegalAccessException, InstantiationException, NotFrozenException
object
- The object to be deleted
Status.OK
and the deleted object's id
if the object was found and successfully deleted.
Status.NOT_EXISTS
if the object is not
in the database.
NotFrozenException
- if the index has not been frozen.
OBStorageException
- If something goes wrong with the DB
OBException
- User generated exception
IllegalAccessException
- If there is a problem when instantiating objects O
InstantiationException
- If there is a problem when instantiating objects OO getObject(long i) throws IllegalIdException, IllegalAccessException, InstantiationException, OBException
i
- The id to be retrieved
OBStorageException
- If something goes wrong with the DB
OBException
- User generated exception
IllegalAccessException
- If there is a problem when instantiating objects O
InstantiationException
- If there is a problem when instantiating objects O
IllegalIdException
void close() throws OBException
OBStorageException
- If something goes wrong with the DB.
OBException
long totalBoxes()
long getBox(O object) throws OBException
object
- The object to be analyzed
OBException
- User generated exceptionlong databaseSize() throws OBStorageException
OBStorageException
- If something goes wrong with the DB
OBStorageException
- If the underlying storage device signaled an error.void init(OBStoreFactory fact) throws OBStorageException, NotFrozenException, IllegalAccessException, InstantiationException, OBException, IOException
#org.obsearch.ambient.Ambient
, users
do not need to worry about this method.
fact
- The storage factory that will be used to store the data.
OBStorageException
- If something goes wrong with the DB
OBException
- User generated exception
IllegalAccessException
- If there is a problem when instantiating objects O
InstantiationException
- If there is a problem when instantiating objects O
NotFrozenException
- if the index has not been frozen.
OBStorageException
- If something goes wrong with the DB.
IOException
- if the index serialization process failsvoid resetStats()
Statistics getStats() throws OBStorageException
OBStorageException
String debug(O object) throws OBException, InstantiationException, IllegalAccessException
IllegalAccessException
InstantiationException
OBException
void setPreFreezeCheck(boolean preFreezeCheck)
preFreezeCheck
- Set the flag.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |