beagle r4656 - trunk/beagle/beagled



Author: dbera
Date: Sat Apr  5 00:49:49 2008
New Revision: 4656
URL: http://svn.gnome.org/viewvc/beagle?rev=4656&view=rev

Log:
Fix a bug uncovered by r4609 - if Indexable.AlreadyFiltered is set, then indexing should continue.
Cleanup the relevant code a bit. NoContent is now only set in LuceneIndexingDriver. FilterFactory merely decides whether the content needs a filter or not.


Modified:
   trunk/beagle/beagled/FilterFactory.cs
   trunk/beagle/beagled/LuceneIndexingDriver.cs

Modified: trunk/beagle/beagled/FilterFactory.cs
==============================================================================
--- trunk/beagle/beagled/FilterFactory.cs	(original)
+++ trunk/beagle/beagled/FilterFactory.cs	Sat Apr  5 00:49:49 2008
@@ -227,18 +227,19 @@
 			return false;
 		}
 
+		/* Returns false if content can't/needn't be indexed.
+		 * If AlreadyFiltered, then we don't return a filter but return true.
+		 */
 		static public bool FilterIndexable (Indexable indexable, TextCache text_cache, out Filter filter)
 		{
 			filter = null;
 			ICollection filters = null;
 
 			if (indexable.Filtering == IndexableFiltering.AlreadyFiltered)
-				return false;
+				return true;
 
-			if (! ShouldWeFilterThis (indexable)) {
-				indexable.NoContent = true;
+			if (! ShouldWeFilterThis (indexable))
 				return false;
-			}
 
 			string path = null;
 
@@ -285,14 +286,10 @@
 
 			// We don't know how to filter this, so there is nothing else to do.
 			if (filters.Count == 0) {
-				if (! indexable.NoContent) {
-					indexable.NoContent = true;
-
+				if (! indexable.NoContent)
 					Logger.Log.Debug ("No filter for {0} ({1}) [{2}]", indexable.DisplayUri, path, indexable.MimeType);
-					return false;
-				}
-				
-				return true;
+
+				return false;
 			}
 
 			foreach (Filter candidate_filter in filters) {
@@ -346,8 +343,7 @@
 
 			if (Debug)
 				Logger.Log.Debug ("None of the matching filters could process the file: {0}", path);
-			indexable.NoContent = true;
-			
+
 			return false;
 		}
 

Modified: trunk/beagle/beagled/LuceneIndexingDriver.cs
==============================================================================
--- trunk/beagle/beagled/LuceneIndexingDriver.cs	(original)
+++ trunk/beagle/beagled/LuceneIndexingDriver.cs	Sat Apr  5 00:49:49 2008
@@ -543,11 +543,14 @@
 
 			// If we have content, try to find a filter
 			// we we can use to process the indexable
+			bool filter_content = false;
 			try {
-				if (! FilterFactory.FilterIndexable (indexable, (disable_textcache ? null : text_cache), out filter))
-					indexable.NoContent = true;
-			} catch (Exception e) {
+				filter_content = FilterFactory.FilterIndexable (indexable, (disable_textcache ? null : text_cache), out filter);
+			} catch { }
+
+			if (! filter_content) {
 				indexable.NoContent = true;
+				filter = null;
 			}
 
 			if (FileFilterNotifier != null)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]