Exemplo n.º 1
0
        private void AddFakeDocument(int fromNodeId)
        {
            //minimal fakeobject: NodeId, VersionId, Path, Version, NodeTimestamp, VersionTimestamp

            var node = Node.LoadNode(fromNodeId);
            var doc  = IndexDocumentInfo.CreateDocument(node);

            doc.RemoveField(LucObject.FieldName.NodeId);
            doc.RemoveField(LucObject.FieldName.VersionId);
            doc.RemoveField(LucObject.FieldName.Name);
            doc.RemoveField(LucObject.FieldName.Path);

            var nf = new NumericField(LucObject.FieldName.NodeId, LucField.Store.YES, true);

            nf.SetIntValue(99999);
            doc.Add(nf);
            nf = new NumericField(LucObject.FieldName.VersionId, LucField.Store.YES, true);
            nf.SetIntValue(99999);
            doc.Add(nf);
            doc.Add(new LucField(LucObject.FieldName.Name, "fakedocument", LucField.Store.YES, LucField.Index.NOT_ANALYZED, LucField.TermVector.NO));
            doc.Add(new LucField(LucObject.FieldName.Path, "/root/fakedocument", LucField.Store.YES, LucField.Index.NOT_ANALYZED, LucField.TermVector.NO));

            LuceneManager.AddCompleteDocument(doc, 0, false);
            LuceneManager.UnregisterActivity(0, false);
        }
Exemplo n.º 2
0
 protected override bool ProtectedExecute()
 {
     if (Document != null)
     {
         if (true == this.SingleVersion)
         {
             return(LuceneManager.AddCompleteDocument(Document, Id, IsUnprocessedActivity, Versioning));
         }
         return(LuceneManager.AddDocument(Document, Id, IsUnprocessedActivity, Versioning));
     }
     return(LuceneManager.AddDocument(Id, IsUnprocessedActivity, Versioning));
 }
Exemplo n.º 3
0
        internal override void Execute()
        {
            using (var optrace = new OperationTrace("AddTreeActivity Execute"))
            {
                var count = 0;
                foreach (var docData in StorageContext.Search.LoadIndexDocumentsByPath(TreeRoot))
                {
                    var doc = IndexDocumentInfo.GetDocument(docData);
                    LuceneManager.AddCompleteDocument(doc);
                    count++;
                }

                Logger.WriteInformation(String.Concat("AddTreeActivity: ", count, " item added"));
                base.Execute();
                optrace.IsSuccessful = true;
            }
        }
Exemplo n.º 4
0
 internal override void Execute()
 {
     using (var optrace = new OperationTrace("AddDocumentActivity Execute"))
     {
         if (Document != null)
         {
             if (true == this.SingleVersion)
             {
                 LuceneManager.AddCompleteDocument(Document);
             }
             else
             {
                 LuceneManager.AddDocument(Document);
             }
         }
         base.Execute();
         optrace.IsSuccessful = true;
     }
 }
Exemplo n.º 5
0
 internal override void Execute()
 {
     try
     {
         if (Document != null)
         {
             if (true == this.SingleVersion)
             {
                 LuceneManager.AddCompleteDocument(Document, this.ActivityId, this.FromExecutingUnprocessedActivities);
             }
             else
             {
                 LuceneManager.AddDocument(Document, this.ActivityId, this.FromExecutingUnprocessedActivities);
             }
         }
     }
     finally
     {
         base.Execute();
     }
 }