Archive for the ‘Lucene’ Category

 

Zend_Search_Lucene_MultiSearcher

9月 28th, 2013

php luceneで久々にちょっと更新していたら、良さそうなのが・・・ http://framework.zend.com/manual/1.12/en/zend.search.lucene.searching.html と思ったけど中身は自分で書いたのと同じで単純に中で配列に持ってるだけだった。 これから使う方は書かない分良いけど、sortやら何やらは全部書くので特に使う理由が無かった。 phpでもマルチスレッド出来るようにならないかなといつも思ってるけど 毎回マルチプロセスのことがマルチスレッドと出てくるのでちょっと。

Read full article | コメントは受け付けていません。

php zend Lucene pagination

1月 24th, 2012

http://framework.zend.com/manual/1.11/en/learning.lucene.pagination.html なんとなくコメントが面白いので。 検索結果のidだけキャッシュしておいて 次ページのときは、idからデータを取得しろというだけですが この結果のインスタンスのサイズが半端ないので、全部キャッシュするのは無理です。 とりあえず、速度だけ計ってみました。 getDocument 100回 0.10254192352295 sec 0.093567132949829 0.091049194335938 search + 100データ取得 + 1000idをcache 0.86610412597656 sec 0.6905689239502 0.69413304328918 ということで、検索は、キーワードやデータ量でかなり変わりますが、getdocument100回のほうが速いことは分かりました。 ページングとキャッシュを実装しました。 基本的には、ページング以外にキャッシュが利用されることは稀なので、memcachedのメモリは少なめに設定です。

Read full article | コメントは受け付けていません。

Lucene+PHPでoptimize時のエラー: failed to open stream: Too many open files

5月 18th, 2011

optimizeしてもエラーになってしまうので、lukeというツールを使えと。 http://www.getopt.org/luke/ とりあえず、使おうと思ったけどGUIなので無理っ lucene部分は、javaで書こうかな、とりあえずsolrを入れてみてから検討しよ。 http://framework.zend.com/manual/en/zend.search.lucene.index-creation.html MergeFactor auto-optimization option MergeFactor determines how often segment indices are merged by addDocument(). With smaller values, less RAM is used while indexing, and searches on unoptimized indices are faster, but indexing speed is slower. With larger values, more RAM is used during indexing, and while searches on unoptimized indices are […]

Read full article | コメントは受け付けていません。

lucene インデックス作成時間

5月 15th, 2011

Lucene lucene.x86_64 1.4.3-1jpp.16 PHP Version => 5.3.6 さくらVPS512 = CPUx2 = processor : 0 vendor_id : GenuineIntel cpu family : 6 model : 15 model name : Intel(R) Core(TM)2 Duo CPU T7700 @ 2.40GHz stepping : 11 cpu MHz : 2660.030 cache size : 4096 KB = memory = 512M 1個 80バイトのデータをbi-gramで1000個入れたら ファイルサイズ 248KB 時間 […]

Read full article | コメントは受け付けていません。

bi-gram解析器でindex & query | Lucene PHP

5月 12th, 2011

英数字連続 + bi-gram解析器のアナライザーを作ってやっと動きました^-^。 ☆以下サイトを参考にさせてもらいました。 Mecab解析器 : http://nonn-et-twk.net/twk/php-lucene-japanese-search CJKIndexを利用して生成した索引の検索 : http://codezine.jp/article/detail/3947?p=3 UTF-8 互換のテキスト解析器 : http://framework.zend.com/manual/ja/zend.search.lucene.charset.html === sample === インデックスに追加! Lib_Bigramが自分のアナライザーです。 Zend_Search_Lucene_Analysis_Analyzer::setDefault( new Lib_Bigram() ) ; //Zend_Search_Lucene_Analysis_Analyzer::setDefault( new Zend_Search_Lucene_Analysis_Analyzer_Common_Utf8()); $indexFile = ‘/tmp/myIndex'; $index = null; if( !is_dir($indexFile) ){ $index = Zend_Search_Lucene::create($indexFile); }else{ $index = Zend_Search_Lucene::open($indexFile); } setIndex( ‘9xyz’,’888『賭博黙示録カイジ』今日は少女時代。999′,$index); setIndex(‘snsd’,’SNSD Live in TOKYO’, $index ); setIndex( ‘123’,’Zend_Search_Lucene は、完全に […]

Read full article | コメントは受け付けていません。

インデックスの構築 | Lucene PHP

5月 11th, 2011

http://framework.zend.com/manual/ja/zend.search.lucene.overview.html Zend_Search_Lucene_Field の型 フィールド型 保存 インデックス化 トークン化 バイナリ Keyword Yes Yes No No UnIndexed Yes No No No Binary Yes No No Yes Text Yes Yes Yes No UnStored No Yes Yes No 使い方によって保存方法を選べますね。自分の場合は、検索だけでデータは、別に保存するので検索して独自のIDだけ取得出来れば大丈夫なので。 $indexFile = ‘/tmp/myIndex'; $index = null; if( !is_dir($indexFile) ){ $index = Zend_Search_Lucene::create($indexFile); }else{ $index = Zend_Search_Lucene::open($indexFile); } // add to index […]

Read full article | コメントは受け付けていません。

install Lucene PHP for centos 64bit

5月 11th, 2011

# yum search lucene Loaded plugins: fastestmirror Determining fastest mirrors * addons: ftp.nara.wide.ad.jp * base: ftp.nara.wide.ad.jp * epel: ftp.kddilabs.jp * extras: ftp.nara.wide.ad.jp * updates: ftp.nara.wide.ad.jp addons | 951 B 00:00 base | 2.1 kB 00:00 epel | 3.7 kB 00:00 epel/primary_db | 3.7 MB 00:00 extras | 2.1 kB 00:00 updates | 1.9 kB 00:00 […]

Read full article | コメントは受け付けていません。