public void Cleanup() { Filter.Cleanup(); Filter.CleanGeneratedIndexables(); Indexable.Cleanup(); Filter = null; Indexable = null; if (PersistentPropDocs != null) { PersistentPropDocs.Clear(); } }
private IndexerAddedReceipt AddIndexableToIndex(Indexable indexable, IndexWriter primary_writer, ref IndexWriter secondary_writer, Hashtable prop_change_docs) { Filter filter = null; if (FileFilterNotifier != null) { FileFilterNotifier(indexable.DisplayUri, indexable.ContentUri, null); // We don't know what filter yet. } // If we have content, try to find a filter // we we can use to process the indexable bool filter_content = false; try { filter_content = FilterFactory.FilterIndexable(indexable, (disable_textcache ? null : text_cache), out filter); } catch { } if (!filter_content) { indexable.NoContent = true; filter = null; } if (FileFilterNotifier != null) { FileFilterNotifier(indexable.DisplayUri, indexable.ContentUri, filter); // Update with our filter } IndexerAddedReceipt r = new IndexerAddedReceipt(indexable.Id); if (filter != null) { if (filter.HasGeneratedIndexable) { Log.Debug("{0} might generate indexables from {1}; deferring until later", indexable.DisplayUri, filter.GetType().ToString()); // This indexable can potentially generate indexables, // so defer its indexing DeferredInfo di; di = new DeferredInfo(indexable, filter, prop_change_docs); deferred_indexables.Insert(0, di); // Since we are deferred, continue. Do not cleanup indexable or remove text-cache yet. // FIXME: Make sure all indexable.Cleanup is called for all indexables if // shutdown is signalled. if (FileFilterNotifier != null) { FileFilterNotifier(null, null, null); // reset } // Return null to signal the indexable was deferred return(null); } // Force the clean-up of temporary files, just in case. // FIXME: I am not sure if the cleanup should happen now. // What is the difference between filter.Cleanup and Indexable.Cleanup ? filter.Cleanup(); r.FilterName = filter.GetType().ToString(); r.FilterVersion = filter.Version; } // If this indexables is not deferred, add it to the index. if (indexable.DisplayUri != indexable.ContentUri) { Log.Debug("+{0} ({1})", indexable.DisplayUri, indexable.ContentUri); } else { Log.Debug("+{0}", indexable.DisplayUri); } Document persistent_prop_doc = null; if (prop_change_docs != null) { persistent_prop_doc = (Document)prop_change_docs [indexable.Uri]; } AddDocumentToIndex(indexable, persistent_prop_doc, primary_writer, ref secondary_writer); if (FileFilterNotifier != null) { FileFilterNotifier(null, null, null); // reset } // Clean up any temporary files associated with filtering this indexable. indexable.Cleanup(); // Remove any existing text cache for this item if (disable_textcache && text_cache != null) { text_cache.Delete(indexable.Uri); } return(r); }