Beispiel #1
0
        public void BuildIndex()
        {
            progressRate = 0;
            //string outputXML;
            //oneNote.GetHierarchy(null, HierarchyScope.hsPages, out outputXML);
            lucene.SetWorkingDirectory();
            lucene.SetUpWriter();
            string outputXML = System.IO.File.ReadAllText(@"D:\\Sample.xml");

            BuildIndex(outputXML);
            lucene.CloseWriter();
        }
Beispiel #2
0
        /// <summary>
        /// Just update lucene index.
        /// </summary>
        private void AddIndexByTime(string indexMode)
        {
            lucene.SetUpWriter(false);
            GetUpdateIndexID(out HashSet <string> deletedID, out HashSet <string> updateID);
            if (isDebug)
            {
                Console.WriteLine("Begining Index Process...");
            }
            foreach (var id in deletedID)
            {
                if (isDebug)
                {
                    Console.WriteLine("Deleting: " + id);
                }
                lucene.DeleteDocumentByID(id);
            }
            AddIndexFromID(updateID, indexMode);
            var currentTime = String.Format("{0:u}", DateTime.UtcNow);

            UserSettings.AddUpdateAppSettings("LastIndexTime", currentTime);
        }