Hi all :)
I have many objects with a url field, of course containing standards
urls...
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 = Ferret::Analysis::AsciiStandardTokenizer.new(str)
    ts = Ferret::Analysis::AsciiLowerCaseFilter.new(ts)
  end
end
system ''rm -rf /tmp/ferret_test'' if
File.exists?(''/tmp/ferret_test'')
File.mkpath(''/tmp/ferret_test'')
INDEX = Ferret::I.new(:path => ''/tmp/ferret_test'',
:analyzer =>
TestAnalyzer.new)
INDEX << {:type => :url, :url =>
''http://google.fr''}
INDEX << {:type => :url, :url =>
''http://ferret.davebalmain.com''}
INDEX << {:type => :url, :url =>
''http://www.unixaumonde.com''}
INDEX << {:type => :url, :url =>
''http://www.rift.fr''}
[''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}"
  INDEX.search(q).hits.each { |x| p INDEX[x.doc].load }
  puts "\n"
end
Thanks by advance !
Regards,
Jeremie ''ahFeel'' BORDIER
Rift Technologies
-- 
Posted via http://www.ruby-forum.com/.