Re: Roadmap for the future.



Hi all,

I've been through the backends and got them to process wildcard clues
properly. At least, I think I have, I haven't looked at the dashboard
code before today (not to mention C#) and this could be completely wrong
:-)

Anyway, here it is. This addresses all the backends which are built by
default (and one or two others). There are a few left which I will look
at in due course.

regards,

dave


On Thu, 2004-02-19 at 04:06, Nat Friedman wrote:

> Make all backends respect wildcard clues.
> -----------------------------------------
> 
>     Difficulty: Easy
> 
>     The 'query' dialog box in dashboard is only useful for debugging
>     because right now the clue type is hard-coded ot whatever we
>     decided was a good clue type for that particular day of the week.
> 
>     Ideally this dialog will have a clue type of '*', the text typed
>     into it will be passed to all the backends, and they will all
>     perform searches on it.
> 
>     Right now Backend.cs:ClueTypeSubscribed will allow wildcard clues
>     to go through to the backends, but then many of them ignore it
>     because there is no clue type specified.
> 
>     Someone should go through all the backends and make them respect
>     the wildcard clue type.

diff -Naur --exclude-from=exclude dashboard/backends/FoafFileBackend.cs dashboard-wildcards/backends/FoafFileBackend.cs
--- dashboard/backends/FoafFileBackend.cs	2004-02-16 09:30:06.000000000 +0000
+++ dashboard-wildcards/backends/FoafFileBackend.cs	2004-02-19 13:06:22.000000000 +0000
@@ -106,11 +106,12 @@
 					// FIXME: this hack assumes that url always comes before
 					// content in a block from a browser frontend.  really
 					// we ought to examine all the clue content first.
+
 					if (ClueTypeSubscribed (c)) {
-							if (c.Type == "foafid")
+							if (c.Type == "foafid" || (c.Type == "*" && Regex.IsMatch(c.Text, "^foaf:(\\w+)\\s+('?.*'?)$")))
 									refs.Add (c);                                          
 							
-							if (c.Type == "rdfurl")
+							if (c.Type == "rdfurl" || (c.Type == "*" && (!Regex.IsMatch(c.Text, "^foaf:(\\w+)\\s+('?.*'?)$"))))
 									files.Add (c);
 					}
 			}
diff -Naur --exclude-from=exclude dashboard/backends/HTMLChainerBackend.cs dashboard-wildcards/backends/HTMLChainerBackend.cs
--- dashboard/backends/HTMLChainerBackend.cs	2004-02-16 09:21:22.000000000 +0000
+++ dashboard-wildcards/backends/HTMLChainerBackend.cs	2004-02-19 13:12:06.000000000 +0000
@@ -255,8 +255,18 @@
 				if (c.Type == "url")
 					baseuri = new Uri (c.Text);
 
+				if (c.Type == "*")
+					try {
+						baseuri = new Uri (c.Text);
+					}
+					catch {
+						/* not a valid URI - treat as content/htmlblock */
+					}	
+				}
+
 				if (c.Type != "content" &&
-				    c.Type != "htmlblock")
+				    c.Type != "htmlblock" &&
+					c.Type != "*")
 				{
 					continue;
 				}
diff -Naur --exclude-from=exclude dashboard/backends/HTMLIndexBackend.cs dashboard-wildcards/backends/HTMLIndexBackend.cs
--- dashboard/backends/HTMLIndexBackend.cs	2004-02-14 03:27:56.000000000 +0000
+++ dashboard-wildcards/backends/HTMLIndexBackend.cs	2004-02-19 13:16:35.000000000 +0000
@@ -52,6 +52,13 @@
 				case "url":
 					url = c;
 					break;
+				case "*":
+					try {
+						validURI = new Uri (c.Text);
+						url = c;
+						break;
+					}
+					catch {} /* fall through & treat as content/htmlblock if it's not a valid URI */
 				case "content":
 				case "htmlblock":
 					content = c;
diff -Naur --exclude-from=exclude dashboard/backends/RhythmboxLibraryBackend.cs dashboard-wildcards/backends/RhythmboxLibraryBackend.cs
--- dashboard/backends/RhythmboxLibraryBackend.cs	2004-02-14 06:03:35.000000000 +0000
+++ dashboard-wildcards/backends/RhythmboxLibraryBackend.cs	2004-02-19 13:21:18.000000000 +0000
@@ -84,7 +84,7 @@
 			SortedList AlbumArray = new SortedList();
 			string clue_text = clue.Text.ToLower ();
 
-			if (clue.Type == "artist") {
+			if (clue.Type == "artist" || clue.Type = "*") {
 
 				// Find matching songs
 				XmlNodeList ArtistMatches = doc.SelectNodes (String.Format("//entry[artist=\"{0}\"]",clue.Text));
--- dashboard/engine/dashboard.cs	2004-02-19 04:30:23.000000000 +0000
+++ dashboard-wildcards/engine/dashboard.cs	2004-02-19 13:37:35.984348960 +0000
@@ -292,7 +292,7 @@
 
 		private void SendQuery (object o, EventArgs e) {
 			CluePacket cp = new CluePacket ("Dashboard", "Default", true);
-			cp.Clues.Add (new Clue ("email", this.window.QueryEntry.Text, 10));
+			cp.Clues.Add (new Clue ("*", this.window.QueryEntry.Text, 10));
 			CluePacketNotifyCallback(cp);
 		}
 


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