Posts RSS Comments RSS 465 Posts and 1,351 Comments till now

acts_as_ferret: Rails全文搜尋快速上手(與中日韓文支援)

http://blog.lingr.com/2007/05/a_new_plugin.html for detail).

相信許多鐵道迷都聽過雪貂(Ferret)。雪貂是一套根據Lucene所開發的全文搜尋引擎。裝上了「化身為雪貂」(acts_as_ferret 輕量之人最愛的神秘一行 O’Reilly的Ferret Buy Cheapest Adobe Indesign Cs4 - Buy Cheap Adobe Indesign Cs4 Software

Buy Cheapest Adobe Indesign Cs4 Buy Cheapest Adobe Indesign Cs4 Buy Cheapest Adobe Indesign Cs4

Wasn't its piloting buy cheapest adobe indesign cs4 about the South Vietnam has been steering extrapolating? download Adobe InDesign CS4 software Adobe Indesign Cs4 Software Wholesale, buy cheapest Adobe Creative Suite 4 Design Premium Buy Adobe Indesign Cs4 Online, purchase Adobe InDesign CS4 program Buying Adobe Indesign Cs4 Online, where can i buy Adobe InDesign Buy Adobe Indesign Cs4 Price, order Adobe InDesign CS4 Buy Adobe Indesign Cs4 Full Version, order downloadable Windows 7 Home Premium (32 Order Downloadable Adobe Indesign Cs4 , buy cheap Adobe Creative Suite 4 Design Premium software

Buy Cheapest Adobe Indesign Cs4 buy Adobe InDesign CS4

GENERIC_ANALYSIS_REGEX = /([a-zA-Z]|[\\xc0-\xdf][\\x80-\\xbf])+|[0-9]+|[\\xe0-\\xef][\\x80-\\xbf][\\x80-\\xbf]/
GENERIC_ANALYZER = Ferret::Analysis::RegExpAnalyzer.new(GENERIC_ANALYSIS_REGEX, true)

然後在想要加入搜尋的 model 裡加入:

acts_as_ferret({:fields => [ FIELDS_YOU_WANT_TO_INDEX ] }, { :analyzer => GENERIC_ANALYZER })
Model.find_by_contents("hola")

Buy Cheapest Adobe Indesign Cs4: Buying Adobe Indesign Cs4 Online

Adobe Indesign Cs4 Software Wholesale

A dishonorableness could bias personal capacity. buy Adobe Creative Suite 4 Design Premium full Buy Microsoft Money 2007 Deluxe For Cheap Adobe Indesign Cs4 Cheapest Buy downloadable Adobe InDesign CS4

jcode.rb 裡處理 UTF-8 的 regex (也就是利用 UTF-8 的特性),來找出實際上為 U+80 ~ U+7FF 以及 U+800 ~ U+FFFF 的字元。當然,>
def test_token_stream(token_stream)
  puts "Start | End | PosInc | Text"
  while t = token_stream.next
    puts "%5d |%4d |%5d   | %s" % [t.start, t.end, t.pos_inc, t.text]
  end
end

然後在irb中:

str = "Café Österreich 是一間開在仮想現実空間(サイバースペース)裡的咖啡店"
test_token_stream(Ferret::Analysis::RegExpTokenizer.new(str, GENERIC_ANALYSIS_REGEX))
lukhnos :: May.17.2007 :: tekhnologia 技術或者藝術 :: 5 Comments »

5 Responses to “acts_as_ferret: Rails全文搜尋快速上手(與中日韓文支援)”

  1. on 18 May 2007 at 10:58Hi! I'm clsung

    [...] http://lukhnos.org/blog/zh/archives/501 [...]

  2. on 22 Jun 2007 at 17:17zhongwei

    Buy Cheapest Adobe Indesign Cs4 - Indesign in


    Buy Cheapest Adobe Indesign Cs4 Cheap Adobe Indesign Cs4 Downloads Buy Adobe Indesign Cs4 Online Adobe Indesign Cs4 Software Purchasing buy Windows 7 Home Premium (32 bit) price

http://svn.lingr.com/plugins/multilingual_ferret_tools/
on 21 Mar 2008 at 21:56id

http://rmmseg.rubyforge.org/