private void BuildAddIndexNode(IIndexDefinition index, IAstNode parent)
        {
            IAddIndexNode addIndexNode = new AddIndexNode(parent, index.Name);
            parent.ChildNodes.Add(addIndexNode);

            SemanticModelUtil.Copy(index, addIndexNode);
        }
        public virtual string GetIndexName(IIndexDefinition index)
        {
            string columnNames = Algorithms.Join("", index.Columns,
                delegate(IIndexColumnDefinition icd) { return icd.Name; });

            return GetIndexNameForColumns(index, columnNames);
        }
        public void create_index()
        {
            _index = new InMemoryProductIndex();

            var manager = new IndexManager();
            manager.RegisterIndex(_index);
            manager.CreateIndexes();
        }
 public ServiceIndexDefinition(IIndexDefinition myIndexDefinition)
 {
     this.Edition = myIndexDefinition.Edition;
     this.ID = myIndexDefinition.ID;
     this.IndexTypeName = myIndexDefinition.IndexTypeName;
     this.IsRange = myIndexDefinition.IsRange;
     this.IsUserdefined = myIndexDefinition.IsUserdefined;
     this.IsVersioned = myIndexDefinition.IsVersioned;
     this.Name = myIndexDefinition.Name;
     this.IndexedProperties = myIndexDefinition.IndexedProperties.Select(x => x.Name).ToList();
 }
 public ServiceIndexDefinition(IIndexDefinition myIndexDefinition)
 {
     this.Name = myIndexDefinition.Name;
     this.ID = myIndexDefinition.ID;
     this.IndexTypeName = myIndexDefinition.IndexTypeName;
     this.Edition = myIndexDefinition.Edition;
     this.IsUserdefined = myIndexDefinition.IsUserdefined;
     this.IndexedProperties = myIndexDefinition.IndexedProperties.Select(x => x.Name).ToList();
     this.VertexType = new ServiceVertexType(myIndexDefinition.VertexType);
     this.SourceIndex = (myIndexDefinition.SourceIndex == null) ? null : new ServiceIndexDefinition(myIndexDefinition.SourceIndex);
     this.IsRange = myIndexDefinition.IsRange;
     this.IsVersioned = myIndexDefinition.IsVersioned;
 }
        public void create_index()
        {
            _index = new InMemoryProductIndex();

            var manager = new IndexManager();
            manager.RegisterIndex(_index);
            manager.CreateIndexes();

            var files = Directory.GetFiles(@"C:\temp\", "*.facet");
            foreach (var file in files)
            {
                File.Delete(file);
            }
        }
 private bool IndexNameMatch(IIndexDefinition value)
 {
     return value.IndexName.Equals(_CurrentIndexName);
 }
 private string IndexDefinitionToResourceKey(IIndexDefinition definition)
 {
     return String.Format("INDEX_{0}", StripSpecialChars(definition.IndexName)).ToUpper();
 }
Example #9
0
 private QueryResult GenerateResult(IRequestStatistics myStats, IIndexDefinition myIndexDefinition)
 {
     return new QueryResult(Query,
                             "sones.gql",
                             Convert.ToUInt64(myStats.ExecutionTime.TotalMilliseconds),
                             ResultType.Successful,
                             new List<IVertexView> { new VertexView(new Dictionary<String, object> { {"CreatedIndex", myIndexDefinition} } ,
                                                                     new Dictionary<String, IEdgeView>()) });
 }
Example #10
0
 private static SingleEdgeUpdateDefinition IndexDefinitionToSingleEdgeUpdate(VertexInformation mySourceVertex, IIndexDefinition myDefinition)
 {
     return new SingleEdgeUpdateDefinition(mySourceVertex, new VertexInformation((long)BaseTypes.Index, myDefinition.ID), (long)BaseTypes.Edge);
 }
 protected virtual string GetIndexNameForColumns(IIndexDefinition index, string columnNames)
 {
     return index.Unique ?? false ?
         string.Format("UQ_{0}", columnNames) :
         string.Format("IX_{0}", columnNames);
 }
        public void create_index()
        {
            //Clean any existing facets before running the tests to make sure
            //we are using new and correct data
            var facetsDirectory = @"C:\temp\facets";

            if (Directory.Exists(facetsDirectory))
            {
                var files = Directory.GetFiles(facetsDirectory, "*.facet");
                foreach (var file in files)
                {
                    File.Delete(file);
                }
            }

            _index = new DiskProductIndex();
            _manager = new IndexManager();
            _manager.RegisterIndex(_index);
            _manager.CreateIndexes();
        }
Example #13
0
 private IQueryResult GenerateResult(IRequestStatistics myStats, IIndexDefinition myIndexDefinition)
 {
     return QueryResult.Success(Query, 
                             SonesGQLConstants.GQL, 
                             new List<IVertexView> { new VertexView(new Dictionary<String, object> { 
                                 {"CreatedIndex", myIndexDefinition}, 
                                 {"CreatedIndexTypeName", myIndexDefinition.IndexTypeName } 
                             }, 
                             new Dictionary<String, IEdgeView>()) },
                             Convert.ToUInt64(myStats.ExecutionTime.TotalMilliseconds));
 }
Example #14
0
 private IUniqueDefinition ConvertIIndexDefinitionToIUniqueDefinition(IIndexDefinition myIndexDefinition)
 {
     return new UniqueDefinition
     {
         DefiningVertexType = this,
         UniquePropertyDefinitions = myIndexDefinition.IndexedProperties,
         CorrespondingIndex = myIndexDefinition,
     };
 }
        private static void BindIndexProperties(IAddIndexNode addIndexNode, IIndexDefinition indexDefinition)
        {
            if(addIndexNode.Properties[MdlSyntax.Unique] != null)
                addIndexNode.Unique = indexDefinition.Unique =
                    Convert.ToBoolean(((IStringAstNodePropertyValue)addIndexNode.Properties[MdlSyntax.Unique].Value).Value);

            if(addIndexNode.Properties[MdlSyntax.Clustered] != null)
                addIndexNode.Clustered = indexDefinition.Clustered =
                    Convert.ToBoolean(((IStringAstNodePropertyValue)addIndexNode.Properties[MdlSyntax.Clustered].Value).Value);

            if(addIndexNode.Properties["where"] != null)
                addIndexNode.Where = indexDefinition.Where = 
                    AstNodePropertyUtil.AsString(addIndexNode.Properties["where"].Value);
        }
 public static IIndexDefinition ConverteOnlyIndexDefinition(IRequestStatistics myRequestStatistics, IIndexDefinition myIndexDefinition)
 {
     return myIndexDefinition;
 }
Example #17
0
        private void RemoveVertexPropertyFromIndex(IVertex aVertex, IIndexDefinition aIndexDefinition, IEnumerable<IIndex<IComparable, long>> myIndices, SecurityToken mySecurityToken, TransactionToken myTransactionToken)
        {
            var entry = CreateIndexEntry(aIndexDefinition.IndexedProperties, aVertex.GetAllProperties().ToDictionary(key => key.Item1, value => value.Item2));

            foreach (var iIndex in myIndices)
            {
                if (iIndex is IMultipleValueIndex<IComparable, long>)
                {
                    lock (iIndex)
                    {
                        if (iIndex.ContainsKey(entry))
                        {
                            var toBeUpdatedIndex = (IMultipleValueIndex<IComparable, long>)iIndex;

                            var payLoad = toBeUpdatedIndex[entry];
                            payLoad.Remove(aVertex.VertexID);

                            toBeUpdatedIndex.Add(entry, payLoad, IndexAddStrategy.REPLACE);
                        }
                    }
                }
                else
                {
                    iIndex.Remove(entry);
                }

            }
        }
Example #18
0
        private static void CopyProperties(IIndexDefinition index, IAddIndexNode addIndexNode)
        {
            if(!string.IsNullOrEmpty(index.Table))
                AddProperty(addIndexNode, MdlSyntax.Table, index.Table);

            if(index.Clustered.GetValueOrDefault(false))
                AddProperty(addIndexNode, MdlSyntax.Clustered, "true");

            if(index.Unique.GetValueOrDefault(false))
                AddProperty(addIndexNode, MdlSyntax.Unique, "true");

            if(index.Columns.Count == 1)
            {
                IAstNodePropertyValue value = GetIndexColumnPropertyValue(index.Columns[0]);
                AddProperty(addIndexNode, MdlSyntax.Column, value);
            } // if
            else
                AddListProperty(addIndexNode, MdlSyntax.Columns, 
                    new List<IIndexColumnDefinition>(index.Columns).ConvertAll<IAstNodePropertyValue>(
                        delegate(IIndexColumnDefinition icd)
                            { return GetIndexColumnPropertyValue(icd); }));
        }