|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object estraier.Database
public class Database
Abstraction of database
Field Summary | |
---|---|
static int |
DBCHRCAT
open mode: use character category analyzer |
static int |
DBCREAT
open mode: a writer creating |
static int |
DBHUGE
open mode: huge tuning |
static int |
DBHUGE2
open mode: huge tuning second |
static int |
DBHUGE3
open mode: huge tuning third |
static int |
DBLARGE
open mode: large tuning |
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 |
DBSCASIS
open mode: refrain from adjustment of scores |
static int |
DBSCINT
open mode: store scores as integer |
static int |
DBSCVOID
open mode: store scores as void |
static int |
DBSMALL
open mode: small tuning |
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 |
GDNOKWD
get_doc option: no keywords |
static int |
GDNOTEXT
get_doc option: no text |
static int |
IDXATTRNUM
attribute index type: for narrowing with attributes as numbers |
static int |
IDXATTRSEQ
attribute index type: for multipurpose sequencial access method |
static int |
IDXATTRSTR
attribute index type: for narrowing with attributes as strings |
static int |
MGCLEAN
merge option: clean up dispensable regions |
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 int |
PDWEIGHT
put_doc option: weight scores statically when indexing |
static java.lang.String |
VERSION
version of Hyper Estraier |
Constructor Summary | |
---|---|
Database()
Create a database object. |
Method Summary | |
---|---|
boolean |
add_attr_index(java.lang.String name,
int type)
Add an index for narrowing or sorting with document attributes. |
boolean |
add_pseudo_index(java.lang.String path)
Add a pseudo index directory. |
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. |
boolean |
merge(java.lang.String name,
int options)
Merge another database. |
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. |
static Result |
search_meta(Database[] dbs,
Condition cond)
Search plural databases for documents corresponding a condition. |
Result |
search(Condition cond)
Search for documents corresponding a condition. |
void |
set_cache_size(double size,
int anum,
int tnum,
int rnum)
Set the maximum size of the cache memory. |
void |
set_informer(DatabaseInformer informer)
Set the callback function to inform of database events. |
void |
set_wildmax(int num)
Set the maximum number of expansion of wild cards. |
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 DBCHRCAT
public static final int DBCREAT
public static final int DBHUGE
public static final int DBHUGE2
public static final int DBHUGE3
public static final int DBLARGE
public static final int DBLCKNB
public static final int DBNOLCK
public static final int DBPERFNG
public static final int DBREADER
public static final int DBSCASIS
public static final int DBSCINT
public static final int DBSCVOID
public static final int DBSMALL
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 GDNOKWD
public static final int GDNOTEXT
public static final int IDXATTRNUM
public static final int IDXATTRSEQ
public static final int IDXATTRSTR
public static final int MGCLEAN
public static final int ODCLEAN
public static final int OPTNODBOPT
public static final int OPTNOPURGE
public static final int PDCLEAN
public static final int PDWEIGHT
public static final java.lang.String VERSION
Constructor Detail |
---|
public Database()
Method Detail |
---|
public boolean add_attr_index(java.lang.String name, int type)
name
- the name of an attribute.type
- the data type of attribute index; `Database.IDXATTRSEQ' for multipurpose
sequencial access method, `Database.IDXATTRSTR' for narrowing with attributes as strings,
`Database.IDXATTRNUM' for narrowing with attributes as numbers.
public boolean add_pseudo_index(java.lang.String path)
path
- the path of a pseudo index directory.
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()
finalize
in class java.lang.Object
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, `Database.GDNOKWD' to ignore keywords. The three can be specified at
# the same time by bitwise or.
public boolean merge(java.lang.String name, int options)
name
- the name of another database directory.options
- options: `Database.MGCLEAN' to clean up dispensable regions of the deleted
document.
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,
`Database.DBCHACAT', which means character category analysis is performed instead of N-gram
analysis, `Database.DBSMALL', which means the index is tuned to register less than 50000
documents, `Database.DBLARGE', which means the index is tuned to register more than 300000
documents, `Database.DBHUGE', which means the index is tuned to register more than 1000000
documents, `Database.DBHUGE2', which means the index is tuned to register more than 5000000
documents, `Database.DBHUGE3', which means the index is tuned to register more than 10000000
documents, `Database.DBSCVOID', which means scores are stored as void, `Database.DBSCINT',
which means scores are stored as 32-bit integer, `Database.DBSCASIS', which means scores
are stored as-is and marked not to be tuned when search.
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 static Result search_meta(Database[] dbs, Condition cond)
dbs
- an array whose elements are database objects.cond
- a 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 void set_informer(DatabaseInformer informer)
informer
- an arbitrary object with a method named as `inform'.public void set_wildmax(int num)
num
- the maximum number of expansion of wild cards.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 |