コード例 #1
0
        /// <summary>
        /// Gets the result item list.
        /// </summary>
        /// <param name="cacheIndexInternal">The cache index internal.</param>
        /// <param name="itemPositionList">The item position list.</param>
        /// <returns>List of ResultItems</returns>
        internal static List<ResultItem> GetResultItemList(CacheIndexInternal cacheIndexInternal, IEnumerable<int> itemPositionList)
        {
            List<ResultItem> resultItemList = new List<ResultItem>();

            foreach (int itemPosition in itemPositionList)
            {
                resultItemList.Add(new ResultItem(cacheIndexInternal.InDeserializationContext.IndexId,
                    cacheIndexInternal.GetItem(itemPosition).ItemId,
                    null,
                    InternalItemAdapter.ConvertToTagDictionary(cacheIndexInternal.GetItem(itemPosition).TagList, cacheIndexInternal.InDeserializationContext)));
            }

            return resultItemList;
        }
コード例 #2
0
        /// <summary>
        /// Gets the index data item list.
        /// </summary>
        /// <param name="cacheIndexInternal">The cache index internal.</param>
        /// <param name="offset">The offset.</param>
        /// <param name="itemNum">If 0 gets all items.</param>
        /// <returns>List of IndexDataItems</returns>
        internal static List<IndexDataItem> GetIndexDataItemList(CacheIndexInternal cacheIndexInternal, int offset, int itemNum)
        {
            if (itemNum == Int32.MaxValue)
            {
                itemNum = cacheIndexInternal.Count;
            }

            List<IndexDataItem> resultItemList = new List<IndexDataItem>(itemNum);

            if (cacheIndexInternal.Count >= offset)
            {
                for (int i = offset - 1; i < cacheIndexInternal.Count && resultItemList.Count < itemNum; i++)
                {
                    resultItemList.Add(new IndexDataItem(cacheIndexInternal.GetItem(i).ItemId,
                        InternalItemAdapter.ConvertToTagDictionary(cacheIndexInternal.GetItem(i).TagList, cacheIndexInternal.InDeserializationContext)));
                }
            }
            return resultItemList;
        }
コード例 #3
0
        /// <summary>
        /// Gets the result item list.
        /// </summary>
        /// <param name="cacheIndexInternal">The cache index internal.</param>
        /// <param name="itemPositionList">The item position list.</param>
        /// <returns>List of ResultItems</returns>
        internal static List <ResultItem> GetResultItemList(CacheIndexInternal cacheIndexInternal, IEnumerable <int> itemPositionList)
        {
            List <ResultItem> resultItemList = new List <ResultItem>();

            foreach (int itemPosition in itemPositionList)
            {
                resultItemList.Add(new ResultItem(cacheIndexInternal.InDeserializationContext.IndexId,
                                                  cacheIndexInternal.GetItem(itemPosition).ItemId,
                                                  null,
                                                  InternalItemAdapter.ConvertToTagDictionary(cacheIndexInternal.GetItem(itemPosition).TagList, cacheIndexInternal.InDeserializationContext)));
            }

            return(resultItemList);
        }
コード例 #4
0
        /// <summary>
        /// Gets the index data item list.
        /// </summary>
        /// <param name="cacheIndexInternal">The cache index internal.</param>
        /// <param name="offset">The offset.</param>
        /// <param name="itemNum">If 0 gets all items.</param>
        /// <returns>List of IndexDataItems</returns>
        internal static List <IndexDataItem> GetIndexDataItemList(CacheIndexInternal cacheIndexInternal, int offset, int itemNum)
        {
            if (itemNum == Int32.MaxValue)
            {
                itemNum = cacheIndexInternal.Count;
            }

            List <IndexDataItem> resultItemList = new List <IndexDataItem>(itemNum);

            if (cacheIndexInternal.Count >= offset)
            {
                for (int i = offset - 1; i < cacheIndexInternal.Count && resultItemList.Count < itemNum; i++)
                {
                    resultItemList.Add(new IndexDataItem(cacheIndexInternal.GetItem(i).ItemId,
                                                         InternalItemAdapter.ConvertToTagDictionary(cacheIndexInternal.GetItem(i).TagList, cacheIndexInternal.InDeserializationContext)));
                }
            }
            return(resultItemList);
        }
コード例 #5
0
        /// <summary>
        /// Gets the tags.
        /// </summary>
        /// <param name="cacheIndexInternal">The cache index internal.</param>
        /// <param name="searchItem">The search item.</param>
        /// <param name="resultItem">The result item.</param>
        internal static void GetTags(CacheIndexInternal cacheIndexInternal, IndexItem searchItem, IndexItem resultItem)
        {
            int searchIndex = cacheIndexInternal.Search(searchItem);
            if (searchIndex > -1)
            {
                IndexItem tempIndexItem = InternalItemAdapter.ConvertToIndexItem(cacheIndexInternal.GetItem(searchIndex), cacheIndexInternal.InDeserializationContext);

                foreach (KeyValuePair<string, byte[]> kvp in tempIndexItem.Tags)
                {
                    if (!resultItem.Tags.ContainsKey(kvp.Key))
                    {
                        resultItem.Tags.Add(kvp.Key, kvp.Value);
                    }
                }
            }
        }