summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2022-09-09 12:13:24 +0800
committerPeng Wu <alexepico@gmail.com>2022-09-09 12:13:24 +0800
commit95d7370ba98e9a669206e1c4709dc62fa9357f72 (patch)
tree8c6eee62d78641e68cb4f3fe81a053b21a65dec0
parent84221ba84701faccc7849becb5a5feca829f56d7 (diff)
downloadlibpinyin-95d7370ba98e9a669206e1c4709dc62fa9357f72.tar.gz
Write FacadeChewingTable2::search_suggestion method
-rw-r--r--src/storage/facade_chewing_table2.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/storage/facade_chewing_table2.h b/src/storage/facade_chewing_table2.h
index 1cf2a1f..0d22b5d 100644
--- a/src/storage/facade_chewing_table2.h
+++ b/src/storage/facade_chewing_table2.h
@@ -129,6 +129,32 @@ public:
}
/**
+ * FacadeChewingTable2::search_suggestion:
+ * @prefix_len: the length of the prefix to be searched.
+ * @prefix_keys: the pinyin key of the prefix to be searched.
+ * @tokens: the array of GArrays to store the matched prefix token.
+ * @returns: the search result of enum SearchResult.
+ *
+ * Search the phrase tokens according to the prefix pinyin keys.
+ *
+ */
+ int search_suggestion(int prefix_len,
+ /* in */ const ChewingKey prefix_keys[],
+ /* out */ PhraseTokens tokens) const {
+ int result = SEARCH_NONE;
+
+ if (NULL != m_system_chewing_table)
+ result |= m_system_chewing_table->search_suggestion
+ (prefix_len, prefix_keys, tokens);
+
+ if (NULL != m_user_chewing_table)
+ result |= m_user_chewing_table->search_suggestion
+ (prefix_len, prefix_keys, tokens);
+
+ return result;
+ }
+
+ /**
* FacadeChewingTable2::add_index:
* @phrase_length: the length of the phrase to be added.
* @keys: the pinyin keys of the phrase to be added.