Chengcai He
2007-Apr-19 08:06 UTC
[Ferret-talk] Chinese full text searching by acts_as_ferret?
How to add Chinese language full text searching function by using acts_as_ferret? RegExpAnalyzer.new(/./,false) this analyzer, i don''t know how to use it! does it works like this: user searching---->acts_as_ferret---->ferret ???? -- Posted via http://www.ruby-forum.com/.
Jens Kraemer
2007-Apr-19 08:10 UTC
[Ferret-talk] Chinese full text searching by acts_as_ferret?
On Thu, Apr 19, 2007 at 10:06:16AM +0200, Chengcai He wrote:> How to add Chinese language full text searching function by using > acts_as_ferret? > > RegExpAnalyzer.new(/./,false) > > this analyzer, i don''t know how to use it! > does it works like this: > > user searching---->acts_as_ferret---->ferretbasically, yes. You can tell acts_as_ferret what analyzer to use with the :analyzer option in the second options hash: class MyModel acts_as_ferret { :fields => { ... } }, { :analyzer => RegExpAnalyzer.new } end background info: the first options hash are acts_as_ferret options, and the second options hash is passed through to Ferret''s Index class. Jens -- Jens Kr?mer webit! Gesellschaft f?r neue Medien mbH Schnorrstra?e 76 | 01069 Dresden Telefon +49 351 46766-0 | Telefax +49 351 46766-66 kraemer at webit.de | www.webit.de Amtsgericht Dresden | HRB 15422 GF Sven Haubold, Hagen Malessa
Chengcai He
2007-Apr-19 13:23 UTC
[Ferret-talk] Chinese full text searching by acts_as_ferret?
Hello everyone! I use the ferret as the following: acts_as_ferret :fields => [:subject, :body], :analyzer => Ferret::Analysis::RegExpAnalyzer.new(/./,false) when i input the english word to search, it''s so cool and so soon to got the result! but when i input the chinese words to search, the ruby allocate all the memory and the computer has no response, after a long long time wait, there''s a exception: failed to allocate memory! In the log file: Adding field body with value ''????'', it''s true that ferret add the chinese text into the index, but i can not search chinese words! I don''t know how to deal with this! -- Posted via http://www.ruby-forum.com/.
Chengcai He
2007-Apr-19 13:49 UTC
[Ferret-talk] Chinese full text searching by acts_as_ferret?
in environment.rb, i add the following code $KCODE = ''u'' require ''jcode'' ENV[''LANG''] = ''en_US.utf8'' require ''acts_as_ferret'' in my model, topic.rb acts_as_ferret :fields => [:subject, :body], :analyzer => Ferret::Analysis::RegExpAnalyzer.new(/./,false) it doesn''t work when i input the chinese word to search! I don''t know how to do! -- Posted via http://www.ruby-forum.com/.
Jens Kraemer
2007-Apr-19 14:17 UTC
[Ferret-talk] Chinese full text searching by acts_as_ferret?
On Thu, Apr 19, 2007 at 03:49:48PM +0200, Chengcai He wrote:> in environment.rb, i add the following code > $KCODE = ''u'' > require ''jcode'' > ENV[''LANG''] = ''en_US.utf8'' > require ''acts_as_ferret'' > > in my model, topic.rb > acts_as_ferret :fields => [:subject, :body], :analyzer => > Ferret::Analysis::RegExpAnalyzer.new(/./,false)to make aaf use your analyzer, please format the call like this: acts_as_ferret { :fields => [:subject, :body] }, { :analyzer => Ferret::Analysis::RegExpAnalyzer.new(/./,false) } I''m seriously thinking about an API change because people always mix up the two hashes. Jens -- Jens Kr?mer webit! Gesellschaft f?r neue Medien mbH Schnorrstra?e 76 | 01069 Dresden Telefon +49 351 46766-0 | Telefax +49 351 46766-66 kraemer at webit.de | www.webit.de Amtsgericht Dresden | HRB 15422 GF Sven Haubold, Hagen Malessa
Phillip Oertel
2007-Apr-21 22:42 UTC
[Ferret-talk] Chinese full text searching by acts_as_ferret?
i would also be very grateful as well if someone could provide an analyzer for chinese text, or some hints how to build one. the StandardAnalyzer ignores all chinese glyphs. cheers, phillip -- Posted via http://www.ruby-forum.com/.