Full Text Search on iPhone
Use OSS libraries on iPhone!
わたなべかずひろ@kaz_29
2010年11月8日月曜日
Who am I
Name: Kazuhiro Watanabe
Work: E2 Inc. => Here!
twitter: @kaz_29
blog: http://d.hatena.ne.jp/kaz_29
I like #iphonedev #cakephp #lithium #php
and #golf #cat and #beer!
2010年11月8日月曜日
Advertisement!
2010年11月8日月曜日
NIFTY Cloud Manager
2010/10/20 out!
http://iphone.e-2.co.jp/
2010年11月8日月曜日
How to use ‘Hyper Estraier’
in your Apps.
http://fallabs.com/hyperestraier/
2010年11月8日月曜日
I like source install!
2010年11月8日月曜日
configure option
$ ./configure --prefix=/usr/local/iphone 
CC=/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2 
CFLAGS=-arch i386
-isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/
iPhoneSimulator4.0.sdk
-I/usr/local/iphone/include -L/usr/local/iphone/lib
CPP=/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/g++-4.2 
AR=/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/ar
インストール先を指定
2010年11月8日月曜日
configure option
$ ./configure --prefix=/usr/local/iphone 
CC=/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2 
CFLAGS=-arch i386
-isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/
iPhoneSimulator4.0.sdk
-I/usr/local/iphone/include -L/usr/local/iphone/lib
CPP=/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/g++-4.2 
AR=/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/ar
Cコンパイラを指定
2010年11月8日月曜日
configure option
$ ./configure --prefix=/usr/local/iphone 
CC=/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2 
CFLAGS=-arch i386
-isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/
iPhoneSimulator4.0.sdk
-I/usr/local/iphone/include -L/usr/local/iphone/lib
CPP=/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/g++-4.2 
AR=/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/ar
Cコンパイル設定を指定
2010年11月8日月曜日
configure option
$ ./configure --prefix=/usr/local/iphone 
CC=/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2 
CFLAGS=-arch i386
-isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/
iPhoneSimulator4.0.sdk
-I/usr/local/iphone/include -L/usr/local/iphone/lib
CPP=/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/g++-4.2 
AR=/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/ar
C++コンパイラを指定
2010年11月8日月曜日
configure option
$ ./configure --prefix=/usr/local/iphone 
CC=/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2 
CFLAGS=-arch i386
-isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/
iPhoneSimulator4.0.sdk
-I/usr/local/iphone/include -L/usr/local/iphone/lib
CPP=/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/g++-4.2 
AR=/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/ar
アーカイブツールを指定
2010年11月8日月曜日
Customize Makefile
# for Simurator
CC = /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2
AR = /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/ar
CFLAGS = -arch i386 -Wall -fPIC -fsigned-char -O3 -fomit-frame-pointer 
 -fforce-addr
# for Device
CC = /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc-4.2
AR = /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ar
CFLAGS = -isysroot /Developer-SDK402/Platforms/iPhoneOS.platform/Developer/
SDKs/iPhoneOS4.0.sdk 
-arch armv6 -Wall -fPIC -fsigned-char -O3 -fomit-frame-pointer -fforce-addr
2010年11月8日月曜日
Add your project
for device
for simulator
2010年11月8日月曜日
Summary
CC,CPP,AR => Change to iOS SDK Tools
CFLAGS
-arch i386(or armv6) => set target architecture
-isysroot => set root path
2010年11月8日月曜日
Test code - Preparation for search
/* dbをオープン */
if (!(db = est_db_open((const char*)cdataPath, ESTDBREADER, &ecode))){
	 return ;
}
/* 検索条件オブジェクトを生成する */
cond = est_cond_new();
	
NSInteger length = sizeof(searchkey);
/* 検索条件オブジェクトに検索式を設定する */
[searchBar.text getCString:(char*)searchkey maxLength:length
encoding:NSUTF8StringEncoding];
est_cond_set_phrase(cond, searchkey);
CBMAP *hints;
hints = cbmapopenex(MINIBNUM);
/* 実際に取得する数を設定 */
est_cond_set_max(cond, 30) ;
2010年11月8日月曜日
Test code - search and get results
/* データベースから検索結果を得る */
result = est_db_search(db, cond, &resnum, hints);
/* ヒット数を取得 */
numHits = (rp = cbmapget(hints, "", 0, NULL)) ? atoi(rp) : resnum;
/* 各該当文書を取得して表示する */
for(i = 0; i < resnum; i++){
/* 文書オブジェクトを取得する */
if(!(doc = est_db_get_doc(db, result[i], 0))) continue;
if((tmptitle = est_doc_attr(doc, "@title")) != NULL) {
NSLog(@"Title: %sn", tmptitle);
}
}
2010年11月8日月曜日
Demo
2010年11月8日月曜日
Demo Data
10,796 html files
total size 75M
PHP Manual
2010年11月8日月曜日
License is important!
2010年11月8日月曜日
Thank you(><)
2010年11月8日月曜日

It eigo 20101029

  • 1.
    Full Text Searchon iPhone Use OSS libraries on iPhone! わたなべかずひろ@kaz_29 2010年11月8日月曜日
  • 2.
    Who am I Name:Kazuhiro Watanabe Work: E2 Inc. => Here! twitter: @kaz_29 blog: http://d.hatena.ne.jp/kaz_29 I like #iphonedev #cakephp #lithium #php and #golf #cat and #beer! 2010年11月8日月曜日
  • 3.
  • 4.
    NIFTY Cloud Manager 2010/10/20out! http://iphone.e-2.co.jp/ 2010年11月8日月曜日
  • 5.
    How to use‘Hyper Estraier’ in your Apps. http://fallabs.com/hyperestraier/ 2010年11月8日月曜日
  • 6.
    I like sourceinstall! 2010年11月8日月曜日
  • 7.
    configure option $ ./configure--prefix=/usr/local/iphone CC=/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2 CFLAGS=-arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/ iPhoneSimulator4.0.sdk -I/usr/local/iphone/include -L/usr/local/iphone/lib CPP=/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/g++-4.2 AR=/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/ar インストール先を指定 2010年11月8日月曜日
  • 8.
    configure option $ ./configure--prefix=/usr/local/iphone CC=/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2 CFLAGS=-arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/ iPhoneSimulator4.0.sdk -I/usr/local/iphone/include -L/usr/local/iphone/lib CPP=/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/g++-4.2 AR=/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/ar Cコンパイラを指定 2010年11月8日月曜日
  • 9.
    configure option $ ./configure--prefix=/usr/local/iphone CC=/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2 CFLAGS=-arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/ iPhoneSimulator4.0.sdk -I/usr/local/iphone/include -L/usr/local/iphone/lib CPP=/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/g++-4.2 AR=/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/ar Cコンパイル設定を指定 2010年11月8日月曜日
  • 10.
    configure option $ ./configure--prefix=/usr/local/iphone CC=/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2 CFLAGS=-arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/ iPhoneSimulator4.0.sdk -I/usr/local/iphone/include -L/usr/local/iphone/lib CPP=/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/g++-4.2 AR=/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/ar C++コンパイラを指定 2010年11月8日月曜日
  • 11.
    configure option $ ./configure--prefix=/usr/local/iphone CC=/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2 CFLAGS=-arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/ iPhoneSimulator4.0.sdk -I/usr/local/iphone/include -L/usr/local/iphone/lib CPP=/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/g++-4.2 AR=/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/ar アーカイブツールを指定 2010年11月8日月曜日
  • 12.
    Customize Makefile # forSimurator CC = /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2 AR = /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/ar CFLAGS = -arch i386 -Wall -fPIC -fsigned-char -O3 -fomit-frame-pointer  -fforce-addr # for Device CC = /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc-4.2 AR = /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ar CFLAGS = -isysroot /Developer-SDK402/Platforms/iPhoneOS.platform/Developer/ SDKs/iPhoneOS4.0.sdk -arch armv6 -Wall -fPIC -fsigned-char -O3 -fomit-frame-pointer -fforce-addr 2010年11月8日月曜日
  • 13.
    Add your project fordevice for simulator 2010年11月8日月曜日
  • 14.
    Summary CC,CPP,AR => Changeto iOS SDK Tools CFLAGS -arch i386(or armv6) => set target architecture -isysroot => set root path 2010年11月8日月曜日
  • 15.
    Test code -Preparation for search /* dbをオープン */ if (!(db = est_db_open((const char*)cdataPath, ESTDBREADER, &ecode))){ return ; } /* 検索条件オブジェクトを生成する */ cond = est_cond_new(); NSInteger length = sizeof(searchkey); /* 検索条件オブジェクトに検索式を設定する */ [searchBar.text getCString:(char*)searchkey maxLength:length encoding:NSUTF8StringEncoding]; est_cond_set_phrase(cond, searchkey); CBMAP *hints; hints = cbmapopenex(MINIBNUM); /* 実際に取得する数を設定 */ est_cond_set_max(cond, 30) ; 2010年11月8日月曜日
  • 16.
    Test code -search and get results /* データベースから検索結果を得る */ result = est_db_search(db, cond, &resnum, hints); /* ヒット数を取得 */ numHits = (rp = cbmapget(hints, "", 0, NULL)) ? atoi(rp) : resnum; /* 各該当文書を取得して表示する */ for(i = 0; i < resnum; i++){ /* 文書オブジェクトを取得する */ if(!(doc = est_db_get_doc(db, result[i], 0))) continue; if((tmptitle = est_doc_attr(doc, "@title")) != NULL) { NSLog(@"Title: %sn", tmptitle); } } 2010年11月8日月曜日
  • 17.
  • 18.
    Demo Data 10,796 htmlfiles total size 75M PHP Manual 2010年11月8日月曜日
  • 19.
  • 20.