Class | TokyoCabinet::TDBQRY |
In: |
tokyocabinet-doc.rb
|
Parent: | Object |
Query is a mechanism to search for and retrieve records corresponding
conditions from table database.
QCSTREQ | = | 0 | query condition: string is equal to | |
QCSTRINC | = | 1 | query condition: string is included in | |
QCSTRBW | = | 2 | query condition: string begins with | |
QCSTREW | = | 3 | query condition: string ends with | |
QCSTRAND | = | 4 | query condition: string includes all tokens in | |
QCSTROR | = | 5 | query condition: string includes at least one token in | |
QCSTROREQ | = | 6 | query condition: string is equal to at least one token in | |
QCSTRRX | = | 7 | query condition: string matches regular expressions of | |
QCNUMEQ | = | 8 | query condition: number is equal to | |
QCNUMGT | = | 9 | query condition: number is greater than | |
QCNUMGE | = | 10 | query condition: number is greater than or equal to | |
QCNUMLT | = | 11 | query condition: number is less than | |
QCNUMLE | = | 12 | query condition: number is less than or equal to | |
QCNUMBT | = | 13 | query condition: number is between two tokens of | |
QCNUMOREQ | = | 14 | query condition: number is equal to at least one token in | |
QCFTSPH | = | 15 | query condition: full-text search with the phrase of | |
QCFTSAND | = | 16 | query condition: full-text search with all tokens in | |
QCFTSOR | = | 17 | query condition: full-text search with at least one token in | |
QCFTSEX | = | 18 | query condition: full-text search with the compound expression of | |
QCNEGATE | = | 1 << 24 | query condition: negation flag | |
QCNOIDX | = | 1 << 25 | query condition: no index flag | |
QOSTRASC | = | 1 | order type: string ascending | |
QOSTRDESC | = | 2 | order type: string descending | |
QONUMASC | = | 3 | order type: number ascending | |
QONUMDESC | = | 4 | order type: number descending | |
QPPUT | = | 1 << 0 | post treatment: modify the record | |
QPOUT | = | 1 << 1 | post treatment: remove the record | |
QPSTOP | = | 1 << 24 | post treatment: stop the iteration | |
MSUNION | = | 0 | set operation type: union | |
MSISECT | = | 1 | set operation type: intersection | |
MSDIFF | = | 2 | set operation type: difference | |
KWMUTAB | = | 1 << 0 | KWIC option: mark up by tabs | |
KWMUCTRL | = | 1 << 1 | KWIC option: mark up by control characters | |
KWMUBRCT | = | 1 << 2 | KWIC option: mark up by square brackets | |
KWNOOVER | = | 1 << 24 | KWIC option: do not overlap | |
KWPULEAD | = | 1 << 25 | KWIC option: pick up the lead string |
Create a query object.
`tdb' specifies the table database
object.
The return value is the new query object.
Add a narrowing condition.
`name' specifies the name of a
column. An empty string means the primary key.
`op'
specifies an operation type: `TokyoCabinet::TDBQRY::QCSTREQ' for
string which is equal to the expression,
`TokyoCabinet::TDBQRY::QCSTRINC' for string which is included in the
expression, `TokyoCabinet::TDBQRY::QCSTRBW' for string which begins
with the expression, `TokyoCabinet::TDBQRY::QCSTREW' for string which
ends with the expression, `TokyoCabinet::TDBQRY::QCSTRAND' for string
which includes all tokens in the expression,
`TokyoCabinet::TDBQRY::QCSTROR' for string which includes at least
one token in the expression, `TokyoCabinet::TDBQRY::QCSTROREQ' for
string which is equal to at least one token in the expression,
`TokyoCabinet::TDBQRY::QCSTRRX' for string which matches regular
expressions of the expression, `TokyoCabinet::TDBQRY::QCNUMEQ' for
number which is equal to the expression,
`TokyoCabinet::TDBQRY::QCNUMGT' for number which is greater than the
expression, `TokyoCabinet::TDBQRY::QCNUMGE' for number which is
greater than or equal to the expression,
`TokyoCabinet::TDBQRY::QCNUMLT' for number which is less than the
expression, `TokyoCabinet::TDBQRY::QCNUMLE' for number which is less
than or equal to the expression, `TokyoCabinet::TDBQRY::QCNUMBT' for
number which is between two tokens of the expression,
`TokyoCabinet::TDBQRY::QCNUMOREQ' for number which is equal to at
least one token in the expression, `TokyoCabinet::TDBQRY::QCFTSPH'
for full-text search with the phrase of the expression,
`TokyoCabinet::TDBQRY::QCFTSAND' for full-text search with all tokens
in the expression, `TokyoCabinet::TDBQRY::QCFTSOR' for full-text
search with at least one token in the expression,
`TokyoCabinet::TDBQRY::QCFTSEX' for full-text search with the
compound expression. All operations can be flagged by bitwise-or:
`TokyoCabinet::TDBQRY::QCNEGATE' for negation,
`TokyoCabinet::TDBQRY::QCNOIDX' for using no index.
`expr' specifies an operand exression.
The return value is
always `nil'.
Generate keyword-in-context strings.
`cols' specifies a
hash containing columns.
`name' specifies the name of a
column. If it is not defined, the first column of the query is specified.
`width' specifies the width of strings picked up around each
keyword. If it is not defined or negative, the whole text is picked up.
`opts' specifies options by bitwise-or:
`TokyoCabinet::TDBQRY::KWMUTAB' specifies that each keyword is marked
up between two tab characters, `TokyoCabinet::TDBQRY::KWMUCTRL'
specifies that each keyword is marked up by the STX (0x02) code and the ETX
(0x03) code, `TokyoCabinet::TDBQRY::KWMUBRCT' specifies that each
keyword is marked up by the two square brackets,
`TokyoCabinet::TDBQRY::KWNOOVER' specifies that each context does not
overlap, `TokyoCabinet::TDBQRY::KWPULEAD' specifies that the lead
string is picked up forcibly. If it is not defined, no option is
specified.
The return value is an array of strings around keywords.
Retrieve records with multiple query objects and get the set of the
result.
`others' specifies an array of the query objects
except for the self object.
`type' specifies a set
operation type: `TokyoCabinet::TDBQRY::MSUNION' for the union set,
`TokyoCabinet::TDBQRY::MSISECT' for the intersection set,
`TokyoCabinet::TDBQRY::MSDIFF' for the difference set. If it is not
defined, `TokyoCabinet::TDBQRY::MSUNION' is specified.
The return
value is an array of the primary keys of the corresponding records. This
method does never fail. It returns an empty array even if no record
corresponds.
If the first query object has the order setting, the result
array is sorted by the order.
Process each corresponding record.
This method needs a block parameter of
the iterator called for each record. The block receives two parameters. The
first parameter is the primary key. The second parameter is a hash
containing columns. It returns flags of the post treatment by bitwise-or:
`TokyoCabinet::TDBQRY::QPPUT' to modify the record,
`TokyoCabinet::TDBQRY::QPOUT' to remove the record,
`TokyoCabinet::TDBQRY::QPSTOP' to stop the iteration.
If
successful, the return value is true, else, it is false.
Execute the search.
The return value is an array of the primary keys of
the corresponding records. This method does never fail. It returns an empty
array even if no record corresponds.
Set the maximum number of records of the result.
`max'
specifies the maximum number of records of the result. If it is not defined
or negative, no limit is specified.
`skip' specifies the
maximum number of records of the result. If it is not defined or not more
than 0, no record is skipped.
The return value is always `nil'.
Set the order of the result.
`name' specifies the name of
a column. An empty string means the primary key.
`type'
specifies the order type: `TokyoCabinet::TDBQRY::QOSTRASC' for string
ascending, `TokyoCabinet::TDBQRY::QOSTRDESC' for string descending,
`TokyoCabinet::TDBQRY::QONUMASC' for number ascending,
`TokyoCabinet::TDBQRY::QONUMDESC' for number descending. If it is not
defined, `TokyoCabinet::TDBQRY::QOSTRASC' is specified.
The return
value is always `nil'.