Using Truveo, Pixsy and Blinkx from C#
The Sideways8 XML View control is used throughout the HookedOn network. I often mention performance in my posts from my three providers (Truveo -the default, Blinkx and Pixsy) and I wanted to show everyone the guts of how I am doing this.
This is not necessarily the fastest way to do this, but for what I am doing in .NET with a user control, it is a very easy way to add new providers and configure new feeds.
The goal of this control was to create a way to view search results from the Truveo, Blinkx and Pixsy APIs. I wanted to be able to make changes via properties that could be done by editing text files or database entries to be able to show new content in the system. If you look at the home pages of HookedOnReality and HookedOnCelebrities you will see some of the configurable properties of the control from the number of images shown, to the length of the title and descriptions, to width, to query etc.
All three controls use the exact same method for making the call to their respective APIs. Many of the specific features of the API's will be added to the controls in future versions. Currently the only control I really do anything special with is the Pixsy control where I use a couple of performance enhancing parameters because of the way I call the API. (pixsy has a NoRollup parameter you can pass in if you do not need any of the provider, calculated info - Truveos API for instance requires a second round trip to their server if you want this info).
The guts of the search occur in the Search function which looks like the following in our Truveo control:
double dblPeriod = 0.0;
DateTime dteTimer = DateTime.Now;
// Create a new XmlDocument
XmlDocument doc = new XmlDocument();
// Load data
string url = baseQuery + "&query=" + Query;
doc.Load(url);
XmlNamespaceManager nsm = new XmlNamespaceManager(doc.NameTable);
nsm.AddNamespace("default", ControlXMLNameSpace);
XmlNodeList xnl = doc.DocumentElement.SelectNodes(ControlXMLSearch, nsm);
rpMyRepeater.DataSource = xnl;
rpMyRepeater.DataBind();
dblPeriod = TimeSpan.FromTicks(DateTime.Now.Ticks - dteTimer.Ticks).TotalSeconds;
From here I make edits to my aspx page to choose which fields I want to display and how I want to display them.
You can get to the data as simply as :
DataBinder.Eval(Container.DataItem, "nodeName")
For me this was a quick way to get three providers up, with decent performance and maximum reconfigurability.
These three APIs are all great resources for adding interesting content to your web site. Give all three a test ride from the Advanced Search pages:
Advanced Search
Check out the relevance and speed for any query you like against all three at the same time:
This is not necessarily the fastest way to do this, but for what I am doing in .NET with a user control, it is a very easy way to add new providers and configure new feeds.
The goal of this control was to create a way to view search results from the Truveo, Blinkx and Pixsy APIs. I wanted to be able to make changes via properties that could be done by editing text files or database entries to be able to show new content in the system. If you look at the home pages of HookedOnReality and HookedOnCelebrities you will see some of the configurable properties of the control from the number of images shown, to the length of the title and descriptions, to width, to query etc.
All three controls use the exact same method for making the call to their respective APIs. Many of the specific features of the API's will be added to the controls in future versions. Currently the only control I really do anything special with is the Pixsy control where I use a couple of performance enhancing parameters because of the way I call the API. (pixsy has a NoRollup parameter you can pass in if you do not need any of the provider, calculated info - Truveos API for instance requires a second round trip to their server if you want this info).
The guts of the search occur in the Search function which looks like the following in our Truveo control:
double dblPeriod = 0.0;
DateTime dteTimer = DateTime.Now;
// Create a new XmlDocument
XmlDocument doc = new XmlDocument();
// Load data
string url = baseQuery + "&query=" + Query;
doc.Load(url);
XmlNamespaceManager nsm = new XmlNamespaceManager(doc.NameTable);
nsm.AddNamespace("default", ControlXMLNameSpace);
XmlNodeList xnl = doc.DocumentElement.SelectNodes(ControlXMLSearch, nsm);
rpMyRepeater.DataSource = xnl;
rpMyRepeater.DataBind();
dblPeriod = TimeSpan.FromTicks(DateTime.Now.Ticks - dteTimer.Ticks).TotalSeconds;
From here I make edits to my aspx page to choose which fields I want to display and how I want to display them.
You can get to the data as simply as :
DataBinder.Eval(Container.DataItem, "nodeName")
For me this was a quick way to get three providers up, with decent performance and maximum reconfigurability.
These three APIs are all great resources for adding interesting content to your web site. Give all three a test ride from the Advanced Search pages:
Advanced Search
Check out the relevance and speed for any query you like against all three at the same time:

0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home