Forum: Ferret Url searching ?

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
ahFeel (Guest)
on 2007-03-22 12:09
Hi all :)

I have many objects with a url field, of course containing standards
I'm trying to match them but i actually got problems with that.

Here's a little code of what i would like to achieve:
require 'rubygems'
require 'ferret'
require 'ftools'

class TestAnalyzer
  def token_stream(field, str)
    ts =
    ts =

system 'rm -rf /tmp/ferret_test' if File.exists?('/tmp/ferret_test')
INDEX = => '/tmp/ferret_test', :analyzer =>
INDEX << {:type => :url, :url => ''}
INDEX << {:type => :url, :url => ''}
INDEX << {:type => :url, :url => ''}
INDEX << {:type => :url, :url => ''}

['type:url AND url:*google*',
 'type:url AND url:*"://foobar"*',
 'type:url AND url:"http://goo"*',
 'type:url AND url:"http://goo*"'].each do |q|
  puts "\nSearching #{q}" { |x| p INDEX[x.doc].load }
  puts "\n"

Thanks by advance !
Jeremie 'ahFeel' BORDIER
Rift Technologies
This topic is locked and can not be replied to.