public virtual void AddIndexOn(string className, string indexName, string[] indexFields
                                       , bool verbose, bool acceptMultipleValuesForSameKey)
        {
            NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo classInfo = GetMetaModel().GetClassInfo
                                                                           (className, true);
            if (classInfo.HasIndex(indexName))
            {
                throw new NeoDatis.Odb.ODBRuntimeException(NeoDatis.Odb.Core.NeoDatisError.IndexAlreadyExist
                                                           .AddParameter(indexName).AddParameter(className));
            }
            NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfoIndex cii = classInfo.AddIndexOn(indexName
                                                                                           , indexFields, acceptMultipleValuesForSameKey);
            NeoDatis.Btree.IBTree btree = null;
            if (acceptMultipleValuesForSameKey)
            {
                btree = new NeoDatis.Odb.Impl.Core.Btree.ODBBTreeMultiple(className, NeoDatis.Odb.OdbConfiguration
                                                                          .GetDefaultIndexBTreeDegree(), new NeoDatis.Odb.Impl.Core.Btree.LazyODBBTreePersister
                                                                              (this));
            }
            else
            {
                btree = new NeoDatis.Odb.Impl.Core.Btree.ODBBTreeSingle(className, NeoDatis.Odb.OdbConfiguration
                                                                        .GetDefaultIndexBTreeDegree(), new NeoDatis.Odb.Impl.Core.Btree.LazyODBBTreePersister
                                                                            (this));
            }
            cii.SetBTree(btree);
            Store(cii);
            // Now The index must be updated with all existing objects.
            if (classInfo.GetNumberOfObjects() == 0)
            {
                // There are no objects. Nothing to do
                return;
            }
            if (verbose)
            {
                NeoDatis.Tool.DLogger.Info("Creating index " + indexName + " on class " + className
                                           + " - Class has already " + classInfo.GetNumberOfObjects() + " Objects. Updating index"
                                           );
            }
            if (verbose)
            {
                NeoDatis.Tool.DLogger.Info(indexName + " : loading " + classInfo.GetNumberOfObjects
                                               () + " objects from database");
            }
            // We must load all objects and insert them in the index!
            NeoDatis.Odb.Objects <object> objects = GetObjectInfos <object>(new NeoDatis.Odb.Impl.Core.Query.Criteria.CriteriaQuery
                                                                                (className), false, -1, -1, false);
            if (verbose)
            {
                NeoDatis.Tool.DLogger.Info(indexName + " : " + classInfo.GetNumberOfObjects() + " objects loaded"
                                           );
            }
            NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo nnoi = null;
            int  i             = 0;
            bool monitorMemory = NeoDatis.Odb.OdbConfiguration.IsMonitoringMemory();

            while (objects.HasNext())
            {
                nnoi = (NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo)objects.Next();
                btree.Insert(cii.ComputeKey(nnoi), nnoi.GetOid());
                if (verbose && i % 1000 == 0)
                {
                    if (monitorMemory)
                    {
                        NeoDatis.Odb.Impl.Tool.MemoryMonitor.DisplayCurrentMemory("Index " + indexName +
                                                                                  " " + i + " objects inserted", true);
                    }
                }
                i++;
            }
            if (verbose)
            {
                NeoDatis.Tool.DLogger.Info(indexName + " created!");
            }
        }