diff options
| author | Peng Wu <alexepico@gmail.com> | 2012-08-28 10:56:12 +0800 |
|---|---|---|
| committer | Peng Wu <alexepico@gmail.com> | 2012-08-28 10:56:12 +0800 |
| commit | c467718af4e0ba7bfcf162f690fb49a1b4d2621b (patch) | |
| tree | c9e59e09e8405829bb31b330907b946b4a94f7a2 /src | |
| parent | 457445fdc6cd0e5446665ec05a8fe25d6d9d49eb (diff) | |
begin to write add/remove index
Diffstat (limited to 'src')
| -rw-r--r-- | src/storage/phrase_large_table2.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/storage/phrase_large_table2.cpp b/src/storage/phrase_large_table2.cpp index 4a0d969..e42b530 100644 --- a/src/storage/phrase_large_table2.cpp +++ b/src/storage/phrase_large_table2.cpp @@ -257,3 +257,30 @@ int PhraseArrayIndexLevel2<phrase_length>::search return result; } +int PhraseBitmapIndexLevel2::add_index(int phrase_length, + /* in */ ucs4_t phrase[], + /* in */ phrase_token_t token){ + guint8 first_key = (phrase[0] & 0xFF00) >> 8; + + PhraseLengthIndexLevel2 * & length_array = + m_phrase_length_indexes[first_key]; + + if ( !length_array ){ + length_array = new PhraseLengthIndexLevel2(); + } + return length_array->add_index(phrase_length, phrase, token); +} + +int PhraseBitmapIndexLevel2::remove_index(int phrase_length, + /* in */ ucs4_t phrase[], + /* in */ phrase_token_t token){ + guint8 first_key = (phrase[0] & 0xFF00) >> 8; + + PhraseLengthIndexLevel2 * & length_array = + m_phrase_length_indexes[first_key]; + + if ( length_array ) + return length_array->remove_index(phrase_length, phrase, token); + + return ERROR_REMOVE_ITEM_DONOT_EXISTS; +} |
