Ferreting Full Text Search

  • Digg this article
  • Sphinn this article
  • Stumble this article
  • Facebook
  • del.icio.us
  • LinkedIn
  • Twit this article
Posted by John
on Monday, 01 December 2008

Got the full-text searching working with the blogging engine, plus it's really fast using the Ferret gem and Will Paginate.

First grab the necessary gems,

sudo gem install ferret acts_as_ferret will_paginate

Then,

require 'will_paginate'
require 'acts_as_ferret'

Next up I defined the elements to search against in the target model (here app/model/article.rb)

acts_as_ferret :fields => [:title, :body, :cached_tag_list]

And then altered the search method to...

@articles = Article.paginate_search params[:search], :page => params[:page], :per_page => $blog.article_count

...you will need to add this class method to handle the pagination with Will Paginate

module ActsAsFerret
  module ClassMethods
    def paginate_search(query, options = {})
      page, per_page, total = wp_parse_options(options)
      pager = WillPaginate::Collection.new(page, per_page, total)
      options.merge!(:offset => pager.offset, :limit => per_page)
      result = find_by_contents(query, options)
      returning WillPaginate::Collection.new(page, per_page, result.total_hits) do |pager|
        pager.replace result
      end
    end
  end
end

...thanks to opensoul.org for this solution.

Works like a charm ;-)

Incoming!

  • Digg this article
  • Sphinn this article
  • Stumble this article
  • Facebook
  • del.icio.us
  • LinkedIn
  • Twit this article
Posted by John
on Tuesday, 28 October 2008

Visitors

Visitors Since Site Inception (late 2005) : 146,790
Visitors This Month : 13,835

Nice to see the visitor count rising, which shows the new engine is doing it's stuff.

The actual DB weighs in at 5mb even with 400 posts, countless links, notes, snippets, etc. plus it handles the digg-effect with ease!

Good stuff, will have to do a future post on this.

;-)

Basic SEO Tactics

  • Digg this article
  • Sphinn this article
  • Stumble this article
  • Facebook
  • del.icio.us
  • LinkedIn
  • Twit this article
Posted by John
on Friday, 02 February 2007

SEO = Search Engine Optimisation

Have you ever wondered whether there was a quick and easy way to get your site noticed by all the search engines around the world, and hence get your site to become more popular?

Well there are several methods, first is simple, just post good content.

Second, post comments on other peoples blogs which will in turn get rooted back to you and hence connect and crawl you up the list (but try to be nice at the same time).

And third is to post your site to all the major search engines, by letting them know you exist you create instant word-of-mouth and jump faster up the ladder.

Below is a list to help get in touch with the big search providers, better than a postcard.

All services are free at time of writing.

More Tips

another tip is to use the Box Model and put everything in div tags, having your main content at the start of the page and everything else below, like sidebars, header, footer, etc.

so when the bots crawl your page the get right to the content first and don’t get confused of side-tracked by anything else.

also include meta-tags, keywords, use the DocType (strict / transitional), always helps, anything to make a bot’s life easier. also a robots.txt file to tell them where they should start and a sitemap.xml to give them a roadmap of your site.