Example #1
0
        internal Guid[] FindObjects(int IndexID, IIndex <T> index, DynamicRole dynamicRole)
        {
            IndexData indexStorage = IndexStorageManager.IndexStorageManager <T> .GetIndexData(IndexID);

            try
            {
                DateTime indexStart = DateTime.Now;
                int?     operations;
                Guid[]   ret = index.FindObjects(indexStorage ?? index.EmptyIndexData, dynamicRole, out operations);
                IndexManager.IndexManager <T> .GetInstance().includeInStatistics(IndexID, IndexCostInformation.OneRoleSearch,
                                                                                 ((float)
                                                                                  (DateTime.Now.Ticks - indexStart.Ticks) /
                                                                                  10000000) / ret.Length == 0
                        ? 1
                        : ret.Length);

                if ((operations ?? 0) > 0)
                {
                    IndexManager.IndexManager <T> .GetInstance().includeInStatistics(IndexID, IndexCostInformation.HitRatio,
                                                                                     ret.Length / (float)operations);
                }
                return(ret);
            }
            catch (Exception ex)
            {
                if (MUTDOD.Server.Common.IndexMechanism.IndexMechanism <T> .GetLoger() != null)
                {
                    MUTDOD.Server.Common.IndexMechanism.IndexMechanism <T> .GetLoger()
                    .Log("IndexMechanism", string.Format("Index {0} throwed exception\n{1}", index.GetType(), ex),
                         MessageLevel.Error);
                }
                throw ex;
            }
        }
Example #2
0
        internal Guid[] FindObjects(int IndexID, IIndex <T> index, T type, bool complexExtension, String[] attributes,
                                    object[] values, CompareType[] compareTypes)
        {
            IndexData indexStorage = IndexStorageManager.IndexStorageManager <T> .GetIndexData(IndexID);

            try
            {
                DateTime indexStart = DateTime.Now;
                int?     operations;
                Guid[]   ret = index.FindObjects(indexStorage ?? index.EmptyIndexData, type, complexExtension, attributes,
                                                 values, compareTypes.ToList().Select(convert).ToArray(), out operations);
                IndexManager.IndexManager <T> .GetInstance().includeInStatistics(IndexID,
                                                                                 IndexCostInformation.OneObjectSearch,
                                                                                 ((float)
                                                                                  (DateTime.Now.Ticks - indexStart.Ticks) /
                                                                                  10000000) / ret.Length == 0
                        ? 1
                        : ret.Length);

                if ((operations ?? 0) > 0)
                {
                    IndexManager.IndexManager <T> .GetInstance().includeInStatistics(IndexID, IndexCostInformation.HitRatio,
                                                                                     ret.Length / (float)operations);
                }
                return(ret);
            }
            catch (Exception ex)
            {
                if (MUTDOD.Server.Common.IndexMechanism.IndexMechanism <T> .GetLoger() != null)
                {
                    MUTDOD.Server.Common.IndexMechanism.IndexMechanism <T> .GetLoger()
                    .Log("IndexMechanism", string.Format("Index {0} throwed exception\n{1}", index.GetType(), ex),
                         MessageLevel.Error);
                }
                throw ex;
            }
        }