David Balmain wrote:
> On 7/7/06, Charlie <[EMAIL PROTECTED]> wrote:
>> And also it is needed to make the new Chinese analyzer work together
>> with the original standard analyzer
> 
> I answered this on the rails list but just in case;
> 
>    # Create a PerFieldAnalyzer (AKA PerFieldAnalyzerWrapper) which
>    # defaults to Standard
>    analyzer = PerFieldAnalyzer.new(StandardAnalyzer.new)
> 
>    # Add a special character analyzer for the chinese field or
>    # whatever field it is that has chinese characters. This splits the
>    # data into single characters.
>    analyzer["chinese"] = RegExpAnalyzer.new(/./, false)

Thank you Dave,I looked up the API and found that 
PerFieldAnalyzerWrapper is useful for field analyze,especially for the 
coresponding SQL: select * from students where title like '%Charlie%' 
and location_id = 1,    where location_id =1 query can be got through 
PerFieldAnalyzerWrapper.

I have just now downloaded and read the book of Lucene In Action,and in 
Chapter 4,it tolds that the standardanalyzer will also split the CJK 
language into tokens although there is no spaces among them,for 
example:'中文字符' will be splitted into tokens of '中' '文' '字' '符',that is 
just what I want. But I still can not search any results from ferret. I 
use the MySQL as the database with all the encoding of UTF-8,and 
also,all of my rails sources is saved in the form of UTF-8,then when I 
input the search box of the above characters of
'中文字符', I will got zero searched results,can you please help with that 
situation? Very Grateful!


Best Regards
Charlie

-- 
Posted via http://www.ruby-forum.com/.
_______________________________________________
Ferret-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ferret-talk

Reply via email to