コード例 #1
0
        public static async Task <string> CreateIndex([ActivityTrigger] DataOpParameters pipe, ILogger log)
        {
            log.LogInformation($"CreateIndex: Starting");
            CreateIndexParameters parms = JObject.Parse(pipe.JsonParameters).ToObject <CreateIndexParameters>();

            try
            {
                Sources           sr     = new Sources(pipe.StorageAccount);
                ConnectParameters target = await sr.GetSourceParameters(parms.TargetName);

                ConnectParameters source = await sr.GetSourceParameters(parms.SourceName);

                Indexer index       = new Indexer(pipe.StorageAccount);
                int     parentNodes = await index.Initialize(target, source, parms.Taxonomy, parms.Filter);

                List <ParentIndexNodes> nodes = await index.IndexParent(parentNodes, parms.Filter);

                for (int j = 0; j < nodes.Count; j++)
                {
                    ParentIndexNodes node = nodes[j];
                    for (int i = 0; i < node.NodeCount; i++)
                    {
                        await index.IndexChildren(j, i, node.ParentNodeId);
                    }
                }

                index.CloseIndex();
            }
            catch (Exception ex)
            {
                log.LogInformation($"CreateIndex: Serious exception {ex}");
            }

            log.LogInformation($"CreateIndex: Complete");
            return($"Hello {pipe.Name}!");
        }