|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectestraier.Database
Abstraction of database
Field Summary | |
static int |
DBCREAT
open mode: a writer creating |
static int |
DBLCKNB
open mode: lock without blocking |
static int |
DBNOLCK
open mode: open without locking |
static int |
DBPERFNG
open mode: use perfect N-gram analyzer |
static int |
DBREADER
open mode: open as a reader |
static int |
DBTRUNC
open mode: a writer truncating |
static int |
DBWRITER
open mode: open as a writer |
static int |
ERRACCES
error code: access forbidden |
static int |
ERRDB
error code: database problem |
static int |
ERRINVAL
error code: invalid argument |
static int |
ERRIO
error code: I/O problem |
static int |
ERRLOCK
error code: lock failure |
static int |
ERRMISC
error code: miscellaneous |
static int |
ERRNOERR
error code: no error |
static int |
ERRNOITEM
error code: no item |
static int |
GDNOATTR
get_doc option: no attributes |
static int |
GDNOTEXT
get_doc option: no text |
static int |
ODCLEAN
out_doc option: clean up dispensable regions |
static int |
OPTNODBOPT
optimize option: omit optimization of the database files |
static int |
OPTNOPURGE
optimize option: omit purging dispensable region of deleted |
static int |
PDCLEAN
put_doc option: clean up dispensable regions |
static java.lang.String |
VERSION
version of Hyper Estraier |
Constructor Summary | |
Database()
Create a database object. |
Method Summary | |
boolean |
close()
Close the database. |
int |
doc_num()
Get the number of documents. |
boolean |
edit_doc(Document doc)
Edit attributes of a document. |
java.lang.String |
err_msg(int ecode)
Get the string of an error code. |
int |
error()
Get the last happened error code. |
boolean |
fatal()
Check whether the database has a fatal error. |
protected void |
finalize()
Release resources. |
boolean |
flush(int max)
Flush index words in the cache. |
java.lang.String |
get_doc_attr(int id,
java.lang.String name)
Retrieve the value of an attribute of a document. |
Document |
get_doc(int id,
int options)
Retrieve a document. |
java.lang.String |
name()
Get the name. |
boolean |
open(java.lang.String name,
int omode)
Open the database. |
boolean |
optimize(int options)
Optimize the database. |
boolean |
out_doc(int id,
int options)
Remove a document. |
boolean |
put_doc(Document doc,
int options)
Add a document. |
boolean |
scan_doc(Document doc,
Condition cond)
Check whether a document object matches the phrase of a search condition object definitely. |
Result |
search(Condition cond)
Search documents corresponding a condition. |
void |
set_cache_size(double size,
int anum,
int tnum,
int rnum)
Set the maximum size of the cache memory. |
double |
size()
Get the size. |
boolean |
sync()
Synchronize updating contents. |
int |
uri_to_id(java.lang.String uri)
Get the ID of a document specified by URI. |
int |
word_num()
Get the number of unique words. |
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int DBCREAT
public static final int DBLCKNB
public static final int DBNOLCK
public static final int DBPERFNG
public static final int DBREADER
public static final int DBTRUNC
public static final int DBWRITER
public static final int ERRACCES
public static final int ERRDB
public static final int ERRINVAL
public static final int ERRIO
public static final int ERRLOCK
public static final int ERRMISC
public static final int ERRNOERR
public static final int ERRNOITEM
public static final int GDNOATTR
public static final int GDNOTEXT
public static final int ODCLEAN
public static final int OPTNODBOPT
public static final int OPTNOPURGE
public static final int PDCLEAN
public static final java.lang.String VERSION
Constructor Detail |
public Database()
Method Detail |
public boolean close()
public int doc_num()
public boolean edit_doc(Document doc)
doc
- a document object.
public java.lang.String err_msg(int ecode)
ecode
- an error code.
public int error()
public boolean fatal()
protected void finalize()
public boolean flush(int max)
max
- the maximum number of words to be flushed. If it not more than zero, all words
are flushed.
public java.lang.String get_doc_attr(int id, java.lang.String name)
id
- the ID number of a registered document.name
- the name of an attribute.
public Document get_doc(int id, int options)
id
- the ID number of a registered document.options
- options: `Database.GDNOATTR' to ignore attributes, `Database.GDNOTEXT' to
ignore the body text. The two can be specified at the same time by bitwise or.
public java.lang.String name()
public boolean open(java.lang.String name, int omode)
name
- the name of a database directory.omode
- open modes: `Database.DBWRITER' as a writer, `Database.DBREADER' as a reader.
If the mode is `Database.DBWRITER', the following may be added by bitwise or:
`Database.DBCREAT', which means it creates a new database if not exist, `Database.DBTRUNC',
which means it creates a new database regardless if one exists. Both of `Database.DBREADER'
and `Database.DBWRITER' can be added to by bitwise or: `Database.DBNOLCK', which means it
opens a database file without file locking, or `Database.DBLCKNB', which means locking is
performed without blocking. If `Database.DBNOLCK' is used, the application is responsible
for exclusion control. `Database.DBCREAT' can be added to by bitwise or:
`Database.DBPERFNG', which means N-gram analysis is performed against European text also.
public boolean optimize(int options)
options
- options: `Database.OPTNOPURGE' to omit purging dispensable region of deleted
documents, `Database.OPTNODBOPT' to omit optimization of the database files. The two can be
specified at the same time by bitwise or.
public boolean out_doc(int id, int options)
id
- the ID number of a registered document.options
- options: `Database.ODCLEAN' to clean up dispensable regions of the deleted
document.
public boolean put_doc(Document doc, int options)
doc
- a document object. The document object should have the URI attribute.options
- options: `Database.PDCLEAN' to clean up dispensable regions of the
overwritten document.
public boolean scan_doc(Document doc, Condition cond)
doc
- a document object.cond
- a search condition object.
public Result search(Condition cond)
cond
- a condition object.
public void set_cache_size(double size, int anum, int tnum, int rnum)
size
- the maximum size of the index cache. By default, it is 64MB. If it is not
more than 0, the current size is not changed.anum
- the maximum number of cached records for document attributes. By default, it
is 8192. If it is not more than 0, the current size is not changed.tnum
- the maximum number of cached records for document texts. By default, it is
1024. If it is not more than 0, the current size is not changed.rnum
- the maximum number of cached records for occurrence results. By default, it
is 256. If it is not more than 0, the current size is not changed.public double size()
public boolean sync()
public int uri_to_id(java.lang.String uri)
uri
- the URI of a registered document.
public int word_num()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |