/// <summary> /// Adds a document to the indexer /// </summary> /// <param name="document">Document to be indexed or added to the indexer</param> public void add(Doocument document) { int id = document.getID(); string text = document.getText(); add(getTokenizedKeywords(text), id); }
/// <summary> /// Performs the main function of getting the newly added documents and add them to the indexer, /// and also get the removed documents and remove them from the indexer /// </summary> public void run() { if (rest) { Thread.Sleep(sleepTime); } while (true) { Indexer indexer = Storage.getStorageDetails().getIndexer(); foreach (string path in Storage.getAddedPaths()) { int id = Storage.getStorageDetails().getAndIncrLastDocumentID(); Doocument document = new Doocument(id, path); indexer.add(document); Storage.getStorageDetails().getDocumentList().Add(document); Storage.getStorageDetails().incrNumberOfDocument(); } foreach (Doocument document in Storage.getRemovedDocuments()) { int id = document.getID(); indexer.remove(id); } Thread.Sleep(20000);//time in milliseconds } }