1. PrefaceTo say a few words, the recent fog in Beijing is really big, choking me this siege division can not resist. You must take good care of your body! When the air is good, sit less and move more. If the conditions are good, you'd better have your boss make an indoor air purifier. Because of those days the average indoor haze index is also high scary T, hey don't say much. Positive text >> This article on the blog
ios-How to build an index to implement a local text search engine that allows fault tolerant search?
http://www.cnblogs.com/qingche/p/4530826.html,After the last blog, a friend asked if they support the question of Chinese, I found that after the test can only enter "Chinese" to search for the corresponding content, and not like Apple search,Enter "Baidu"
> Search to "enter" "BD" > Search "Baidu "Realize the effect of today's time to expand the original local text search engine, formally support the English search for Chinese.
about how to build an index to implement a local text search engine can look at the above blog. Today the main share of the next
How to achieve English (first letter, Hanyu Pinyin) search for Chinese, I hope to have some help for the friends who need it.2. How to convert Chinese into pinyin, first letterThe first step is to use cocoapods to pull the pinyin frame into your project, or directly on my GitHub fetch-"Https://github.com/SaupClear/PinYinLib Import header file." H
#import "ChineseInclude.h"
#import "PinYinForObjc.h"Basic example: Core approach
Determine if the string is Chinese if ([Chineseinclude isincludechineseinstring:@ "Baidu"])//Then convert Chinese to pinyin nsstring *pybody = [PINYINFOROBJC chineseconverttopinyin:@ "Baidu"];//at the same time convert Chinese into pinyin initials nsstring *pyheader = [PINYINFOROBJC chineseconverttopinyinhead:@ "Baidu"] ;
.
3. How to integrate into the local fault-tolerant search engine with three steps ready, we'll be able to synthesize it into our
local search engine .
mentioned in the previous blog post,
retrieves the location of the Data Warehouse initialization
Also add pinyin and pinyin initials to the Association for (Menuitemobject *objmenu in Allmenus) { //detect if there is a Chinese if ([Chineseinclude IsIncludeChineseInString:objmenu.displayname]) { //convert to pinyin, and Pinyin first letter nsstring *pybody = [PINYINFOROBJC ChineseConvertToPinYin:objmenu.displayname]; NSString *pyheader = [PINYINFOROBJC chineseConvertToPinYinHead:objmenu.displayname]; Associate its index on a local search engine [[permissiveresearchdatabase shareddatabase] Addretainedobjet:objmenu forkey:pybody]; [[Permissiveresearchdatabase Shareddatabase] Addretainedobjet:objmenu forkey:pyheader]; } [[Permissiveresearchdatabase Shareddatabase] Addretainedobjet:objmenu forKey:objmenu.displayname];}
can then support English Baidu, BD-to-Chinese searchFor a local search engine implementation details, you can view my previous blog
ios-How to build an index to implement a local text search engine that allows fault tolerant search? http://www.cnblogs.com/qingche/p/4530826.html,To achieve the effect of any questions welcome message, free I will answer together!Clear Saup
Source: http://www.cnblogs.com/qingche/
This article is copyright to the author and the blog Park is shared, welcome reprint, but must retain this paragraph statement, and in the article page obvious location to give the original text connection.
ios-local text fault-tolerant search engine 2--> How to achieve English (English initials, Hanyu Pinyin) search for Chinese?