public void CustomDocumentToLuceneDocument()
        {
            //test AddDocumentFields
            var customSandoDocument            = new SandoDocument(MyCustomProgramElementForTesting.GetProgramElement());
            var luceneDocumentWithCustomFields = customSandoDocument.GetDocument();

            Assert.IsTrue(luceneDocumentWithCustomFields != null);
        }
Exemple #2
0
 public void DocumentIndexer_AddDocumentDoesNotThrowWhenValidData()
 {
     try
     {
         _documentIndexer = new DocumentIndexer();
         ClassElement  classElement  = SampleProgramElementFactory.GetSampleClassElement();
         SandoDocument sandoDocument = DocumentFactory.Create(classElement);
         Assert.NotNull(sandoDocument);
         Assert.NotNull(sandoDocument.GetDocument());
         _documentIndexer.AddDocument(sandoDocument);
     }
     catch (Exception ex)
     {
         Assert.Fail(ex.Message + ". " + ex.StackTrace);
     }
 }
Exemple #3
0
        public virtual void AddDocument(SandoDocument sandoDocument)
        {
            Contract.Requires(sandoDocument != null, "DocumentIndexer:AddDocument - sandoDocument cannot be null!");

            Document tempDoc = sandoDocument.GetDocument();

            IndexWriter.AddDocument(tempDoc);
            lock (_lock)
            {
                if (_synchronousCommits)
                {
                    CommitChanges();
                }
                else
                if (!_hasIndexChanged)     //if _hasIndexChanged is false, then turn it into true
                {
                    _hasIndexChanged = true;
                }
            }
        }