RSS 2.0 Feed
RSS 2.0


Atom 1.0 Feed
Atom 1.0

  My New Blog Search 


qt8gt0bxhw|20009F4EEE83|RyanMain|subtext_Content|Text|0xfbfffd0000000000d300000001000400

After my last post, I decided to do what I outlined to throw together a quick search page for my blog. Give it a try:

Not too bad for a few minutes of playing around. Basically I did use Scott Mitchell's RssFeed server control. I take the search value and set it as the source for the control like this:

string search = string.Format("http://beta.search.msn.com/results.aspx?q=site%3Aryanfarley.com+{0}&format=rss", 
                              HttpUtility.HtmlEncode(SearchText.Text));
RssFeed1.DataSource = search;
RssFeed1.DataBind();

That's it. The rest was just adding some formatting via the RssFeed control's properties. Search away.




                   



Leave a comment below.

Comments

  1. Eric W. Bachtal 1/12/2005 2:25 PM
    Gravatar
    Sweet. Simple. Very nice.
  2. Jeremy 1/12/2005 4:01 PM
    Gravatar
    Very nice indeed but I found a bug/issue/slight nitpick.

    Try searching for Unicode. You have no search results so it shows nothing. I almost thought it wasn't working until I figured out that I was searching for the wrong material.

    Simple fix:
    if (search == "")
    {
    search = "No results found"
    }

    Well that's sort of it. You would have to convert the results to HTML to render properly. Adding bold or italicizing the error message would probably be a nice bonus too.
  3. RoudyBob.NET 1/12/2005 7:22 PM
    Gravatar
  4. RoudyBob.NET 1/12/2005 7:42 PM
    Gravatar
  5. Ryan Farley 1/12/2005 8:42 PM
    Gravatar
    Jeremy,

    Thanks for the feedback. Great idea. There's actually other bugs I need to work out still - I just didn't have time to address them before and just wanted to throw the base part of it together.

    After I get the rest of the bugs worked out and add your suggestion I'll see if there is some generic way to package it all up for use with other .Text blogs.

    Thanks,
    -Ryan
  6. Ryan Farley 1/12/2005 9:28 PM
    Gravatar
    OK Jeremy. I changed things a bit. Scott's RssFeed control can bind to a XPathDocument instead of a URI. I took that approach so I could load the XML and get details from it pre-bind.

    Much better now.
  7. Gary's Blog 1/13/2005 4:04 AM
    Gravatar
  8. Gary's Blog 1/13/2005 6:10 AM
    Gravatar
  9. Kent Chen 1/13/2005 9:32 AM
    Gravatar
    Just noticed that the search results only return the content that has been index into MSN, any contents that are not indexed won't be able to show up. Another words, it won't give you the full feature of the search result.

    Please correct me if I am wrong.

    I have been looking for the search feature for a while since I use .text as my blog platform. Besides upgrading to the new version of the .text (0.96) which gave me the trouble to install, this one is the best one so far. I will deploy it in anyway.
  10. Kent Chen 1/13/2005 10:05 AM
    Gravatar
    additional to my last comment, it seems that only the content on the first page will not be searchable.
  11. Ryan Farley 1/13/2005 11:15 AM
    Gravatar
    Thanks for the comments Kent. Yes, the search will only return items that have been previously indexed by MSN search. That's not too bad of a trade off considering the solution only took 20 minutes or so to put together and I didn't have to write any of the actual searching or indexing code myself. I have been toying with the idea of adding a custom search solution where I could use the MetaBlogAPI or going direct to SQL server, but haven't thought it through enough to come up with a design I am happy with (and have the time for). At least for now this is "something".

    I don't have a problem finding posts in the search that appear on the main page. For example, I can search for IHtmlDocument, which I posted about only a few posts ago, and it comes back fine. Part of the problem you were seeing is that I was toying around with some ideas like adding the word "archive" to every search so it would only bring back hits with the word archive in the URL in an attempt to weed out some of the category & other "listing" pages and just get to the actual posts. I've removed that now as it was not giving the best results. Seems better now.

    Thanks,
    -Ryan
  12. Kent Chen 1/13/2005 10:21 PM
    Gravatar
    How come nothing happens when I click the search button? Should I put the search.aspx page on the seperate folder?

    By the way, you are amazing...20 minutes only took me figure out how the user control works. :)
  13. Jeremy 1/14/2005 3:40 PM
    Gravatar
    Much more professional looking by including the number of responses and the search text when nothing is found.

    A search of .Text blogs would be a good idea but if your site is indexed on MSN then there's honestly no need as this would serve the purpose quite well. It may lag behind as MSN indexes the pages but it's a small price to pay for search you can use NOW.

    I'm definately feeling the Zen.
  14. Dave Burke 1/29/2005 6:51 PM
    Gravatar
    Ryan, This is slick and you've done an excellent job describing its implementation. I went with 0.96's Lucene and ScheduledEvents components and it works really well, but this is sweet, too!

    btw, here's my 0.96 lucene implementation. Not quite as streamlined as your approach.

    http://dbvt.com/blog/archive/2005/01/24/786.aspx

    You've got a heckuva blog, Virtual Public Guy! Subscribed!
  15. Ryan Farley 2/15/2005 9:14 AM
    Gravatar
    Thanks Dave! Nery nice. I really like your customized blog. That's the biggest advantage of hosting your own blog. Any tweaks or changes you can just make yourself.

    -Ryan
  16. Bryant Likes's Blog 3/17/2005 2:49 PM
    Gravatar
  17. Bryant Likes's Blog 3/17/2005 4:58 PM
    Gravatar
  18. Mischa Kroon 9/6/2005 4:25 AM
    Gravatar
    This is a great way to add search to a website, and it's so simple that you will probably love it. ...
Comments have been closed on this topic.



 

News


Also see my CRM Developer blog

Connect:   @ryanfarley@mastodon.social

         

Sponsor

Sections