summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2022-08-25 14:00:40 +0800
committerPeng Wu <alexepico@gmail.com>2022-08-25 14:00:40 +0800
commit96aeb47a5e9b0f7069975ee2507d1e695fc3f4cd (patch)
treee93ee74c5871383f92de84a3255c96b6f7272f0a
parente5d4ca32ad8f7766d47d94ee40614b8bec6023c7 (diff)
downloadlibpinyin-96aeb47a5e9b0f7069975ee2507d1e695fc3f4cd.tar.gz
Write FacadePhraseTable3::search_suggestion method
-rw-r--r--src/storage/facade_phrase_table3.h25
1 files changed, 25 insertions, 0 deletions
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
@@ -129,6 +129,31 @@ public:
}
/**
+ * 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.
* @phrase: the ucs4 characters of the phrase to be added.