Esempio n. 1
0
        /// <summary>
        /// 插入词
        /// </summary>
        /// <param name="storeIndex"></param>
        /// <param name="word"></param>
        /// <returns></returns>
        public virtual bool Insert(StoreIndexInfo storeIndex, WordInfo word)
        {
            if (storeIndex == null || word == null)
            {
                return(false);
            }
            string indexName = GetStoreName(storeIndex.Name, word.Name);

            if (!WordDictionarties.ContainsKey(indexName))
            {
                var words = Storer.Read <IList <WordInfo> >(indexName);
                words = words ?? new List <WordInfo>();
                WordDictionarties.Add(indexName, words);
            }
            var infos = WordDictionarties[indexName];

            return(InsertWord(storeIndex, word, infos));
        }
Esempio n. 2
0
 /// <summary>
 /// 更新词
 /// </summary>
 /// <param name="storeIndex"></param>
 /// <param name="word"></param>
 /// <returns></returns>
 public virtual bool Update(StoreIndexInfo storeIndex, WordInfo word)
 {
     return(Remove(storeIndex, word.Name) && Insert(storeIndex, word));
 }