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); LuceneManager.ApplyChanges(); }
private void DeleteDocument(int versionId) { var term = new Term(LucObject.FieldName.VersionId, Lucene.Net.Util.NumericUtils.IntToPrefixCoded(versionId)); LuceneManager._writer.DeleteDocuments(term); LuceneManager.ApplyChanges(); }
[Description("An activity execution with update activity after delete activity not throws any exception.")] // ?? public void Indexing_ActivitesWithMissingVersion() { var content = Content.CreateNew("Car", TestRoot, "Car_Indexing_ActivitesWithMissingVersion"); var handler = (GenericContent)content.ContentHandler; //handler.VersioningMode = VersioningType.None; content.Save(); var id = content.Id; LuceneManager.ApplyChanges(); IndexingActivity[] act = new IndexingActivity[3]; act[0] = new IndexingActivity { ActivityType = IndexingActivityType.RemoveDocument, NodeId = _fakeId, VersionId = _fakeId }; act[1] = new IndexingActivity { ActivityType = IndexingActivityType.UpdateDocument, NodeId = _fakeId, VersionId = _fakeId }; act[2] = new IndexingActivity { ActivityType = IndexingActivityType.AddDocument, NodeId = _fakeId, VersionId = _fakeId }; try { using (var context = new IndexingDataContext()) { foreach (var a in act) { context.IndexingActivities.InsertOnSubmit(a); context.SubmitChanges(); } } var max = 0; var activities = IndexingActivityManager.GetUnprocessedActivities(act[2].IndexingActivityId - 1, out max); foreach (var a in activities) { IndexingActivityManager.ExecuteActivityDirect(a); } } finally { RemoveFakeTestActivity(); } }
internal override void Execute() { LuceneManager.ApplyChanges(this.ActivityId); }
internal override void Execute() { LuceneManager.ApplyChanges(); }