beagle r4630 - trunk/beagle/beagled



Author: dbera
Date: Sat Mar 22 00:46:25 2008
New Revision: 4630
URL: http://svn.gnome.org/viewvc/beagle?rev=4630&view=rev

Log:
* Really start in a query-only mode (no optimization task etc.) with --indexing-delay -1
* Fix a bug in the context length API recently added
* Lowercase the stemmed terms returned from a query and also lower case the words when comparing with the stemmed term. Our lucene matches words in a case insensitive way, why should snippets be case sensitive.


Modified:
   trunk/beagle/beagled/LuceneQueryable.cs
   trunk/beagle/beagled/QueryDriver.cs
   trunk/beagle/beagled/SnippetFu.cs

Modified: trunk/beagle/beagled/LuceneQueryable.cs
==============================================================================
--- trunk/beagle/beagled/LuceneQueryable.cs	(original)
+++ trunk/beagle/beagled/LuceneQueryable.cs	Sat Mar 22 00:46:25 2008
@@ -104,7 +104,8 @@
 
 			// If the queryable is in read-only more, don't 
 			// instantiate an indexer for it.
-			if (read_only_mode)
+			// FIXME: --indexing-delay -1 is a hack for --read-only; need to fix this
+			if (read_only_mode || QueryDriver.IndexingDelay < 0)
 				return;
 
 			indexer = LocalIndexerHook ();

Modified: trunk/beagle/beagled/QueryDriver.cs
==============================================================================
--- trunk/beagle/beagled/QueryDriver.cs	(original)
+++ trunk/beagle/beagled/QueryDriver.cs	Sat Mar 22 00:46:25 2008
@@ -130,6 +130,7 @@
 
 		public static int IndexingDelay {
 			set { indexing_delay = value; }
+			get { return indexing_delay; }
 		}
 
 		//////////////////////////////////////////////////////////////////////////////////////
@@ -533,7 +534,7 @@
 					continue;
 				if (sb.Length > 0)
 					sb.Append (' ');
-				sb.Append (LuceneCommon.Stem (split [i]));
+				sb.Append (LuceneCommon.Stem (split [i].ToLower ()));
 			}
 			response.StemmedText.Add (sb.ToString ());
 		}

Modified: trunk/beagle/beagled/SnippetFu.cs
==============================================================================
--- trunk/beagle/beagled/SnippetFu.cs	(original)
+++ trunk/beagle/beagled/SnippetFu.cs	Sat Mar 22 00:46:25 2008
@@ -127,8 +127,8 @@
 		// Keep a sliding window of the starting positions of words
 		SlidingWindow sliding_window;
 
-		public const int context_length_default = 6;
-		public const int snippet_length_default = 200;
+		private const int context_length_default = 6;
+		private const int snippet_length_default = 200;
 
 		private int context_length;
 		private int snippet_length;
@@ -138,13 +138,13 @@
 			this.line_reader = line_reader;
 			this.found_snippet_length = 0;
 			this.full_text = full_text;
-			this.context_length = (context_length >= 0 ? context_length : context_length_default);
+			this.context_length = (context_length > 0 ? context_length : context_length_default);
 			this.snippet_length = (snippet_length > 0 ? snippet_length : snippet_length_default);
 
 			if (query_terms == null)
 				return;
 
-			this.sliding_window = new SlidingWindow (context_length);
+			this.sliding_window = new SlidingWindow (this.context_length);
 
 			// remove stop words from query_terms
 			query_terms_list = new ArrayList (query_terms.Length);
@@ -278,7 +278,7 @@
 					// We cache the token, so as to avoid stemming it more than once
 					// when considering multiple terms.
 					if (stemmed_token == null) {
-						stemmed_token = LuceneCommon.Stem (token);
+						stemmed_token = LuceneCommon.Stem (token.ToLower ());
 					}
 
 					if (String.Compare ((string) stemmed_terms [i], stemmed_token, true) != 0)



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