IGSearch 0.3.2

IGSearch 0.3.2

测试已测试
语言语言 CC
许可证 MIT
发布最新发布2014年12月

Francis Chong 维护。



 
依赖
FMDB/独立>= 0
sqlite3>= 0
CocoaLumberjack>= 0
 

IGSearch 0.3.2

  • Francis Chong 和 Steven Gravell

一个简单的支持中日韩语言的 Objective-C 全文搜索引擎。

为什么

  • Core Data 搜索不支持全文搜索。
  • 随 iOS 捆绑的 SQLite3 没有支持中日韩语言全文搜索的正确分词器。
  • 一个简单易用的 API,独立于数据模型。

设置

使用 CocoaPods,将以下内容添加到你的 Podfile

pod 'IGSearch'

运行 pod install,然后你就可以开始了!

使用

首先,创建一个数据库。

IGSearch* search = [[IGSearch alloc] initWithPath:aPath]; 

然后,索引文档。

[search indexDocument:@{@"title": @"Street Fighter 4", @"system": @"Xbox 360"} withId:@"1"];
[search indexDocument:@{@"title": @"Super Mario Bros", @"system": @"NES"} withId:@"2"];
[search indexDocument:@{@"title": @"Sonic", @"system": @"Mega Drive"} withId:@"3"];
[search indexDocument:@{@"title": @"Mega Man", @"system": @"NES"} withId:@"4"];

搜索文档很简单

[search search:@"Street"]; // @[ @{@"title": @"Street Fighter 4", @"system": @"Xbox 360"} ]
[search search:@"Mega" withField:@"title"]; // @[ @{@"title": @"Mega Man", @"system": @"NES"}  ]

或者只搜索文档 ID

[search search:@"Mega" withField:@"title" fetchIdOnly:YES]; // @[ @"4" ]

致谢

使用了来自Mozilla Thunderbird的 SQLite porter stemmer,Mozilla Public License 许可证。

许可证

本软件使用 MIT 许可证。