From 96aeb47a5e9b0f7069975ee2507d1e695fc3f4cd Mon Sep 17 00:00:00 2001 From: Peng Wu Date: Thu, 25 Aug 2022 14:00:40 +0800 Subject: Write FacadePhraseTable3::search_suggestion method --- src/storage/facade_phrase_table3.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'src') diff --git a/src/storage/facade_phrase_table3.h b/src/storage/facade_phrase_table3.h index 3f71421..9ad9e85 100644 --- a/src/storage/facade_phrase_table3.h +++ b/src/storage/facade_phrase_table3.h @@ -128,6 +128,31 @@ public: return result; } + /** + * FacadePhraseTable3::search_suggestion: + * @phrase_length: the length of the prefix to be searched. + * @phrase: the ucs4 characters of the prefix to be searched. + * @tokens: the GArray of tokens to store the matched phrases. + * @returns: the search result of enum SearchResult. + * + * Search the phrase tokens according to the ucs4 prefix characters. + * + */ + int search_suggestion(int phrase_length, /* in */ const ucs4_t phrase[], + /* out */ PhraseTokens tokens) const { + int result = SEARCH_NONE; + + if (NULL != m_system_phrase_table) + result |= m_system_phrase_table->search_suggestion + (phrase_length, phrase, tokens); + + if (NULL != m_user_phrase_table) + result |= m_user_phrase_table->search_suggestion + (phrase_length, phrase, tokens); + + return result; + } + /** * FacadePhraseTable3::add_index: * @phrase_length: the length of the phrase to be added. -- cgit v1.2.1